Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h @ 8152

Last change on this file since 8152 was 8152, checked in by simonmie, 13 years ago

added nice particleEffect if shield is hit

  • Property svn:eol-style set to native
File size: 6.8 KB
RevLine 
[2072]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#ifndef _Pawn_H__
30#define _Pawn_H__
31
32#include "OrxonoxPrereqs.h"
[3196]33
34#include <string>
[6524]35#include "interfaces/PickupCarrier.h"
[3196]36#include "interfaces/RadarViewable.h"
[5735]37#include "worldentities/ControllableEntity.h"
[2072]38
[6711]39namespace orxonox // tolua_export
40{ // tolua_export
41    class _OrxonoxExport Pawn // tolua_export
42        : public ControllableEntity, public RadarViewable, public PickupCarrier
43    { // tolua_export
[3053]44        friend class WeaponSystem;
45
[2072]46        public:
47            Pawn(BaseObject* creator);
48            virtual ~Pawn();
49
50            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
51            virtual void tick(float dt);
52
53            inline bool isAlive() const
54                { return this->bAlive_; }
55
[8145]56///////////////////////////////// me
57            virtual void setReloadRate(float reloadrate);
58            inline float getReloadRate() const
59                { return this->reloadRate_; }
60
61            inline void addShieldHealth(float amount)
62            { this->setShieldHealth(this->shieldHealth_ + amount); }
63
[8152]64            inline bool hasShield()
65            { return (this->getShieldHealth() > 0); }
66
[8145]67///////////////////////////////// end me
68
[2072]69            virtual void setHealth(float health);
70            inline void addHealth(float health)
71                { this->setHealth(this->health_ + health); }
72            inline void removeHealth(float health)
73                { this->setHealth(this->health_ - health); }
[2662]74            inline float getHealth() const
[2072]75                { return this->health_; }
76
77            inline void setMaxHealth(float maxhealth)
78                { this->maxHealth_ = maxhealth; this->setHealth(this->health_); }
79            inline float getMaxHealth() const
80                { return this->maxHealth_; }
81
82            inline void setInitialHealth(float initialhealth)
83                { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); }
84            inline float getInitialHealth() const
85                { return this->initialHealth_; }
86
[7163]87            inline void setShieldHealth(float shieldHealth)
88            { this->shieldHealth_ = shieldHealth; }
89            inline float getShieldHealth()
90            { return this->shieldHealth_; }
91
92            inline void setShieldAbsorption(float shieldAbsorption)
93            { this->shieldAbsorption_ = shieldAbsorption; }
94            inline float getShieldAbsorption()
95            { return this->shieldAbsorption_; }
96
[2072]97            inline ControllableEntity* getLastHitOriginator() const
98                { return this->lastHitOriginator_; }
99
100            virtual void hit(Pawn* originator, const Vector3& force, float damage);
[6417]101            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
[2072]102            virtual void kill();
103
[6417]104            virtual void fired(unsigned int firemode);
[3053]105            virtual void reload();
[2072]106            virtual void postSpawn();
107
[3053]108            void addWeaponSlot(WeaponSlot * wSlot);
[2662]109            WeaponSlot * getWeaponSlot(unsigned int index) const;
[3053]110            void addWeaponSet(WeaponSet * wSet);
[2662]111            WeaponSet * getWeaponSet(unsigned int index) const;
[3053]112            void addWeaponPack(WeaponPack * wPack);
[6417]113            void addWeaponPackXML(WeaponPack * wPack);
[3053]114            WeaponPack * getWeaponPack(unsigned int index) const;
[2662]115
[7163]116            virtual void addedWeaponPack(WeaponPack* wPack) {}
117
[2662]118            inline const WorldEntity* getWorldEntity() const
119                { return const_cast<Pawn*>(this); }
120
121            inline void setSpawnParticleSource(const std::string& source)
122                { this->spawnparticlesource_ = source; }
123            inline const std::string& getSpawnParticleSource() const
124                { return this->spawnparticlesource_; }
125
126            inline void setSpawnParticleDuration(float duration)
127                { this->spawnparticleduration_ = duration; }
128            inline float getSpawnParticleDuration() const
129                { return this->spawnparticleduration_; }
130
131            inline void setExplosionChunks(unsigned int chunks)
132                { this->numexplosionchunks_ = chunks; }
133            inline unsigned int getExplosionChunks() const
134                { return this->numexplosionchunks_; }
135
[3089]136            virtual void startLocalHumanControl();
[2662]137
[6417]138            void setAimPosition( Vector3 position )
139                { this->aimPosition_ = position; }
140            Vector3 getAimPosition()
141                { return this->aimPosition_; }
[7163]142
[7547]143            virtual const Vector3& getCarrierPosition(void) const
[6540]144                { return this->getWorldPosition(); };
[6417]145
[2072]146        protected:
[7889]147            virtual void preDestroy();
148
[3038]149            virtual void setPlayer(PlayerInfo* player);
150            virtual void removePlayer();
151
[2072]152            virtual void death();
[3087]153            virtual void goWithStyle();
[2662]154            virtual void deatheffect();
155            virtual void spawneffect();
[2072]156
[6417]157            virtual void damage(float damage, Pawn* originator = 0);
158
[2072]159            bool bAlive_;
160
[7547]161            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
[6711]162                { return new std::vector<PickupCarrier*>(); }
[7547]163            virtual PickupCarrier* getCarrierParent(void) const
[6524]164                { return NULL; }
[2662]165
[8145]166/////////////////////////// me
167            float reloadRate_;
168
169////////////////////////// end me
170
[2072]171            float health_;
172            float maxHealth_;
173            float initialHealth_;
[7163]174            float shieldHealth_;
175            float shieldAbsorption_; // Has to be between 0 and 1
[2072]176
[7655]177            WeakPtr<Pawn> lastHitOriginator_;
[2098]178
179            WeaponSystem* weaponSystem_;
[3053]180            bool bReload_;
[2662]181
182            std::string spawnparticlesource_;
183            float spawnparticleduration_;
184            unsigned int numexplosionchunks_;
[3053]185
186        private:
[7163]187            void registerVariables();
[3053]188            inline void setWeaponSystem(WeaponSystem* weaponsystem)
189                { this->weaponSystem_ = weaponsystem; }
[6417]190
191            Vector3 aimPosition_;
[6711]192    }; // tolua_export
193} // tolua_export
[2072]194
195#endif /* _Pawn_H__ */
Note: See TracBrowser for help on using the repository browser.