Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/modularships/src/orxonox/items/ShipPart.h @ 10019

Last change on this file since 10019 was 10019, checked in by noep, 11 years ago

Continued working on ShipPart and ModularSpaceShip implementation

File size: 2.8 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"
34
35#include <string>
36
37
38namespace orxonox // tolua_export
39{ // tolua_export
40    class _OrxonoxExport ShipPart // tolua_export
41        : public Item
42    { // tolua_export
43
44        public:
45            ShipPart(Context* context);
46            virtual ~ShipPart();
47
48            //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
49
50            virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
51
52            //virtual void attachTo(Pawn* newParent);
53            //virtual void detach();
54
55            void addEntity(StaticEntity* entity);
56            StaticEntity* getEntity(unsigned int index);
57            bool hasEntity(StaticEntity* entity) const;
58
59            void printEntities(); // FIXME: (noep) remove debug
60
61            virtual void setDamageAbsorption(float value);
62            inline float getDamageAbsorption()
63                { return this->damageAbsorption_; }
64
65            virtual void setHealth(float health);
66            inline void addHealth(float health)
67                { this->setHealth(this->health_ + health); }
68            inline void removeHealth(float health)
69                { this->setHealth(this->health_ - health); }
70            inline float getHealth() const
71                { return this->health_; }
72
73
74            // FIXME: (noep) Why doesn't this work? Works fine in Engine.h
75            //void addToSpaceShip(ModularSpaceShip* ship);
76
77        protected:
78            Pawn* parent_;
79            unsigned int parentID_; // Object ID of the SpaceShip the Part is mounted on.
80
81            float damageAbsorption_;
82            float health_;
83
84        private:
85            std::vector<StaticEntity*> entityList_; // list of all entities which belong to this part
86
87    }; // tolua_export
88} // tolua_export
89
90#endif /* _ShipPart_H__ */
Note: See TracBrowser for help on using the repository browser.