Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Presentation_HS17_merge/src/modules/asteroidmining/AsteroidMinable.h @ 11730

Last change on this file since 11730 was 11667, checked in by remartin, 7 years ago

Added tilting for the spicedAsteroidBelt. Finished commenting, polish up. Done.

File size: 5.4 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 *      Fabian 'x3n' Landau
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 "OrxonoxPrereqs.h"
77
78#include <string>
79#include <vector>
80#include "interfaces/PickupCarrier.h"
81#include "interfaces/RadarViewable.h"
82#include "worldentities/ControllableEntity.h"
83#include "worldentities/ExplosionPart.h"
84
85#include "../../orxonox/worldentities/pawns/Pawn.h"
86
87namespace orxonox{
88
89
90    class _OrxonoxExport AsteroidMinable : public Pawn{ 
91
92        public:
93            // @brief This constructor is for XML access only!
94            AsteroidMinable(Context* context);
95            // @brief Call this Constructor from other C-files.
96            AsteroidMinable(Context* c, float size, Vector3 position, bool dS);
97
98            virtual ~AsteroidMinable();
99            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
100            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
101            virtual void tick(float dt) override;
102
103            // @brief overloading that to prevent asteroids from taking damage from each other (domino effect etc. )
104            virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
105            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
106
107            inline void setSize(int s){this->size = s;}
108            inline int getSize(){return this->size;}
109
110            inline void toggleShattering(bool b){this->generateSmaller = b;}
111            inline bool doesShatter(){return this->generateSmaller;}
112
113            inline void toggleDropStuff(bool b){this->dropStuff = b;}
114            inline bool doesDropStuff(){return this->dropStuff;}
115
116        protected:
117
118            Context* context;
119
120            int size; //!< Implies health and type of dropped pickups
121            bool generateSmaller; //!< Whether this asteroid leaves fragments
122            bool dropStuff; //!< Whether this asteroid yields valuable stuff
123
124            // @brief Überschreibt die Methode in Pawn
125            virtual void death(); 
126
127        private:
128
129            bool initialised; //!< Used in relation to the constructor detour described above
130
131            void registerVariables();
132
133            // @brief Helper method.
134            virtual void putStuff();
135
136            // @brief If the option generateSmaller is enabled, individual fragments are added with this method.
137            virtual void spawnChildren();
138
139            // @brief Just for testing. Don-t work anyways.
140            void printArrayString(float thingy[]);
141            // @brief Just for testing. Don-t work anyways.
142            void printArrayString(int thingy[]);
143
144    }; // tolua_export
145} // tolua_export
146
147#endif /* _AsteroidMinable_H__ */
Note: See TracBrowser for help on using the repository browser.