Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/3DPacman_FS18/src/modules/asteroidmining/AsteroidMinable.h @ 11847

Last change on this file since 11847 was 11781, checked in by landauf, 7 years ago

eol-style native (no changes in code)

  • Property svn:eol-style set to native
File size: 4.6 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      remartin
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29
30/**
31
32    @file
33    @author remartin
34    @brief An asteroid which can be destroyed. Some smaller asteroids are created and a pickup spawns.
35
36HANDBUCH:
37o Die Collision Shape kann nur im Konstruktor hinzugefügt werden. Die XML-Argumente werden aber erst nach dem Konstruktor gesetzt.
38  Darum wird hier beim ersten Aufruf der tick()-Methode via putStuff() ein komplett neuer Asteroid generiert und der alte zerstört.
39o im Level-File includes/pickups.oxi importieren.
40
41OFFEN/Weiterentwicklung:
42o @TODO Add resource pickups.
43--> data_extern/images/effects: PNG's für die Pickups
44--> https://www.orxonox.net/jenkins/view/Management/job/orxonox_doxygen_trunk/javadoc/group___pickup.html
45
46o Density doesn't add up to 1...
47o Does collision damage work properly
48o Add sound effect (crunching etc. ) (No sound in space...)
49o Explosion parts
50
51ANDERORTS VERÄNDERTE SACHEN:
52Pickup-Zeug:
53o Pickup.h: createSpawner() neu public statt private
54o PickupSpawner.h: Zugriffsrechte setPickupTemplateName() und setMaxSpawnedItems()
55o PickupSpawner.h: In Tick() zwei Testbedingungen eingefügt.
56o Pawn.h: Attribut acceptsPickups_ inklusive get/set.
57
58ERLEGTE FEHLER:
59o Grössenabhängige Collision Shape -> putStuff-Methode, Werte noch nicht durchgesickert.
60o setHealth: maxHealth() des pawns setzen!
61o Asteroiden fressen Pickups: Argument in Pawn, Test darauf in Tick() von PickupSpawner.
62o i++ einfach ganz verhindern, ++i stattdessen.
63o Velocity didn-t get passed properly through the 2nd constructor. Used get/set instead.
64o Rand() geht bis zu riesigen Nummern! rnd() ist zwischen 0 und 1
65
66NOTIZEN:
67o SUPER
68o Warnungsverhinderung anderswo: (void)pickedUp; // To avoid compiler warning.
69o friend class Pickupable;
70
71*/
72
73#ifndef _AsteroidMinable_H__
74#define _AsteroidMinable_H__
75
76#include "AsteroidMiningPrereqs.h"
77
78#include "worldentities/pawns/Pawn.h"
79
80namespace orxonox{
81
82
83    class _AsteroidMiningExport AsteroidMinable : public Pawn
84    {
85        public:
86            AsteroidMinable(Context* context);
87            virtual ~AsteroidMinable();
88
89            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
90            virtual void tick(float dt) override;
91
92            // @brief overloading that to prevent asteroids from taking damage from each other (domino effect etc. )
93            virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
94            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
95
96            void setSize(float s);
97            inline float getSize(){return this->size;}
98
99            inline void setShattering(bool b){this->generateSmaller = b;}
100            inline bool doesShatter(){return this->generateSmaller;}
101
102            inline void setDropStuff(bool b){this->dropStuff = b;}
103            inline bool doesDropStuff(){return this->dropStuff;}
104
105        protected:
106
107            float size; //!< Implies health and type of dropped pickups
108            bool generateSmaller; //!< Whether this asteroid leaves fragments
109            bool dropStuff; //!< Whether this asteroid yields valuable stuff
110
111            // @brief Überschreibt die Methode in Pawn
112            virtual void death(); 
113
114        private:
115
116            bool initialised; //!< Used in relation to the constructor detour described above
117
118            void registerVariables();
119
120            // @brief Helper method.
121            virtual void putStuff();
122
123            // @brief If the option generateSmaller is enabled, individual fragments are added with this method.
124            virtual void spawnChildren();
125
126    }; // tolua_export
127} // tolua_export
128
129#endif /* _AsteroidMinable_H__ */
Note: See TracBrowser for help on using the repository browser.