Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/items/ShipPart.h @ 10996

Last change on this file since 10996 was 10624, checked in by landauf, 9 years ago

merged branch core7 back to trunk

  • Property svn:eol-style set to native
File size: 4.3 KB
RevLine 
[10019]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 *      Noe Pedrazzini
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _ShipPart_H__
30#define _ShipPart_H__
31
32#include "OrxonoxPrereqs.h"
33#include "Item.h"
[10052]34#include "items/PartDestructionEvent.h"
[10019]35
36#include <string>
37
38
39namespace orxonox // tolua_export
40{ // tolua_export
41    class _OrxonoxExport ShipPart // tolua_export
42        : public Item
43    { // tolua_export
44
45        public:
46            ShipPart(Context* context);
47            virtual ~ShipPart();
48
[10023]49            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
[10019]50
51            virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
52
[10023]53            virtual void death();
[10067]54            virtual void explode();
[10023]55
[10019]56            //virtual void attachTo(Pawn* newParent);
57            //virtual void detach();
58
59            void addEntity(StaticEntity* entity);
60            StaticEntity* getEntity(unsigned int index);
61            bool hasEntity(StaticEntity* entity) const;
62
[10052]63            void addDestructionEvent(PartDestructionEvent* event);
64            PartDestructionEvent* getDestructionEvent(unsigned int index);
65
[10019]66            virtual void setDamageAbsorption(float value);
67            inline float getDamageAbsorption()
68                { return this->damageAbsorption_; }
69
[10023]70            void setParent(ModularSpaceShip* ship);
71            inline ModularSpaceShip* getParent()
72                { return this->parent_; }
73
[10058]74            inline void setEventExecution(bool var)
75                { this->eventExecution_ = var; }
76            inline bool isEventExecution()
77                { return this->eventExecution_; }
78
[10019]79            virtual void setHealth(float health);
80            inline void addHealth(float health)
81                { this->setHealth(this->health_ + health); }
82            inline void removeHealth(float health)
83                { this->setHealth(this->health_ - health); }
84            inline float getHealth() const
85                { return this->health_; }
86
[10023]87            inline void setMaxHealth(float maxhealth)
88                { this->maxHealth_ = maxhealth; this->setHealth(this->health_); }
89            inline float getMaxHealth() const
90                { return this->maxHealth_; }
[10019]91
[10023]92            inline void setInitialHealth(float initialhealth)
93                { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); }
94            inline float getInitialHealth() const
95                { return this->initialHealth_; }
96
[10067]97            inline void setExplosionPosition(Vector3 pos)
98                { this->explosionPosition_ = pos; }
99            inline Vector3 getExplosionPosition()
100                { return this->explosionPosition_; }
[10023]101
[10067]102
[10019]103            // FIXME: (noep) Why doesn't this work? Works fine in Engine.h
104            //void addToSpaceShip(ModularSpaceShip* ship);
105
106        protected:
[10023]107            ModularSpaceShip* parent_;
[10055]108            unsigned int parentID_;     // Object ID of the SpaceShip the Part is mounted on.
[10019]109
110            float damageAbsorption_;
111            float health_;
[10023]112            float maxHealth_;
113            float initialHealth_;
[10019]114
115        private:
[10055]116            std::vector<StaticEntity*> entityList_;         // List of all entities which belong to this part
[10052]117            std::vector<PartDestructionEvent*> eventList_;  // The list of all PartDestructionEvent assigned to this ShipPart.
[10019]118
[10058]119            bool eventExecution_;
[10052]120
[10071]121            float healthMem_;
122
[10067]123            Vector3 explosionPosition_;
[10053]124
[10067]125
[10019]126    }; // tolua_export
127} // tolua_export
128
129#endif /* _ShipPart_H__ */
Note: See TracBrowser for help on using the repository browser.