Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 11819 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
RevLine 
[11547]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:
[11741]23 *      remartin
[11547]24 *   Co-authors:
25 *      ...
26 *
27 */
28
[11664]29
30/**
31
[11667]32    @file
33    @author remartin
34    @brief An asteroid which can be destroyed. Some smaller asteroids are created and a pickup spawns.
[11664]35
[11667]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
[11664]71*/
72
[11547]73#ifndef _AsteroidMinable_H__
74#define _AsteroidMinable_H__
75
[11731]76#include "AsteroidMiningPrereqs.h"
[11547]77
[11736]78#include "worldentities/pawns/Pawn.h"
[11547]79
[11667]80namespace orxonox{
[11547]81
82
[11736]83    class _AsteroidMiningExport AsteroidMinable : public Pawn
84    {
[11547]85        public:
[11667]86            AsteroidMinable(Context* context);
[11736]87            virtual ~AsteroidMinable();
[11586]88
[11547]89            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
90            virtual void tick(float dt) override;
91
[11667]92            // @brief overloading that to prevent asteroids from taking damage from each other (domino effect etc. )
[11581]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
[11739]96            void setSize(float s);
97            inline float getSize(){return this->size;}
[11581]98
[11736]99            inline void setShattering(bool b){this->generateSmaller = b;}
[11664]100            inline bool doesShatter(){return this->generateSmaller;}
101
[11736]102            inline void setDropStuff(bool b){this->dropStuff = b;}
[11664]103            inline bool doesDropStuff(){return this->dropStuff;}
[11581]104
[11640]105        protected:
[11547]106
[11739]107            float size; //!< Implies health and type of dropped pickups
[11667]108            bool generateSmaller; //!< Whether this asteroid leaves fragments
109            bool dropStuff; //!< Whether this asteroid yields valuable stuff
[11664]110
[11667]111            // @brief Überschreibt die Methode in Pawn
[11551]112            virtual void death(); 
[11547]113
[11667]114        private:
[11551]115
[11667]116            bool initialised; //!< Used in relation to the constructor detour described above
[11551]117
[11547]118            void registerVariables();
[11667]119
120            // @brief Helper method.
[11640]121            virtual void putStuff();
[11547]122
[11667]123            // @brief If the option generateSmaller is enabled, individual fragments are added with this method.
124            virtual void spawnChildren();
125
[11547]126    }; // tolua_export
127} // tolua_export
128
129#endif /* _AsteroidMinable_H__ */
Note: See TracBrowser for help on using the repository browser.