[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" |
---|
[2500] | 33 | #include "objects/pickup/ShipEquipment.h" |
---|
[2072] | 34 | #include "objects/worldentities/ControllableEntity.h" |
---|
[2485] | 35 | #include "objects/RadarViewable.h" |
---|
[2493] | 36 | #include "objects/weaponSystem/WeaponSystem.h" |
---|
[2072] | 37 | |
---|
| 38 | namespace orxonox |
---|
| 39 | { |
---|
[2485] | 40 | class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable |
---|
[2072] | 41 | { |
---|
| 42 | public: |
---|
| 43 | Pawn(BaseObject* creator); |
---|
| 44 | virtual ~Pawn(); |
---|
| 45 | |
---|
| 46 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
| 47 | virtual void tick(float dt); |
---|
| 48 | void registerVariables(); |
---|
| 49 | |
---|
| 50 | inline bool isAlive() const |
---|
| 51 | { return this->bAlive_; } |
---|
| 52 | |
---|
| 53 | virtual void setHealth(float health); |
---|
| 54 | inline void addHealth(float health) |
---|
| 55 | { this->setHealth(this->health_ + health); } |
---|
| 56 | inline void removeHealth(float health) |
---|
| 57 | { this->setHealth(this->health_ - health); } |
---|
[2485] | 58 | inline float getHealth() const |
---|
[2072] | 59 | { return this->health_; } |
---|
| 60 | |
---|
| 61 | inline void setMaxHealth(float maxhealth) |
---|
| 62 | { this->maxHealth_ = maxhealth; this->setHealth(this->health_); } |
---|
| 63 | inline float getMaxHealth() const |
---|
| 64 | { return this->maxHealth_; } |
---|
| 65 | |
---|
| 66 | inline void setInitialHealth(float initialhealth) |
---|
| 67 | { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); } |
---|
| 68 | inline float getInitialHealth() const |
---|
| 69 | { return this->initialHealth_; } |
---|
| 70 | |
---|
| 71 | inline ControllableEntity* getLastHitOriginator() const |
---|
| 72 | { return this->lastHitOriginator_; } |
---|
| 73 | |
---|
| 74 | virtual void damage(float damage, Pawn* originator = 0); |
---|
| 75 | virtual void hit(Pawn* originator, const Vector3& force, float damage); |
---|
| 76 | virtual void kill(); |
---|
| 77 | |
---|
[2493] | 78 | virtual void fire(WeaponMode::Enum fireMode); |
---|
[2072] | 79 | virtual void postSpawn(); |
---|
| 80 | |
---|
[2493] | 81 | void setWeaponSlot(WeaponSlot * wSlot); |
---|
| 82 | WeaponSlot * getWeaponSlot(unsigned int index) const; |
---|
| 83 | void setWeaponPack(WeaponPack * wPack); |
---|
| 84 | WeaponPack * getWeaponPack(unsigned int firemode) const; |
---|
| 85 | void setWeaponSet(WeaponSet * wSet); |
---|
| 86 | WeaponSet * getWeaponSet(unsigned int index) const; |
---|
| 87 | |
---|
[2485] | 88 | inline const WorldEntity* getWorldEntity() const |
---|
| 89 | { return (WorldEntity*)this; } |
---|
| 90 | |
---|
| 91 | inline void setSpawnParticleSource(const std::string& source) |
---|
| 92 | { this->spawnparticlesource_ = source; } |
---|
| 93 | inline const std::string& getSpawnParticleSource() const |
---|
| 94 | { return this->spawnparticlesource_; } |
---|
| 95 | |
---|
| 96 | inline void setSpawnParticleDuration(float duration) |
---|
| 97 | { this->spawnparticleduration_ = duration; } |
---|
| 98 | inline float getSpawnParticleDuration() const |
---|
| 99 | { return this->spawnparticleduration_; } |
---|
| 100 | |
---|
| 101 | inline void setExplosionChunks(unsigned int chunks) |
---|
| 102 | { this->numexplosionchunks_ = chunks; } |
---|
| 103 | inline unsigned int getExplosionChunks() const |
---|
| 104 | { return this->numexplosionchunks_; } |
---|
| 105 | |
---|
[2500] | 106 | inline ShipEquipment& getPickUp() |
---|
| 107 | {return this->pickUp;} |
---|
| 108 | |
---|
| 109 | virtual void dropItems(); |
---|
| 110 | |
---|
[2072] | 111 | protected: |
---|
| 112 | virtual void death(); |
---|
[2485] | 113 | virtual void deatheffect(); |
---|
| 114 | virtual void spawneffect(); |
---|
[2072] | 115 | |
---|
[2500] | 116 | ShipEquipment pickUp; |
---|
[2072] | 117 | bool bAlive_; |
---|
| 118 | |
---|
[2501] | 119 | |
---|
[2072] | 120 | float health_; |
---|
| 121 | float maxHealth_; |
---|
| 122 | float initialHealth_; |
---|
| 123 | |
---|
| 124 | Pawn* lastHitOriginator_; |
---|
[2098] | 125 | |
---|
| 126 | WeaponSystem* weaponSystem_; |
---|
[2493] | 127 | unsigned int fire_; |
---|
[2501] | 128 | unsigned int firehack_; |
---|
[2485] | 129 | |
---|
| 130 | std::string spawnparticlesource_; |
---|
| 131 | float spawnparticleduration_; |
---|
| 132 | unsigned int numexplosionchunks_; |
---|
[2072] | 133 | }; |
---|
[2485] | 134 | |
---|
[2493] | 135 | class _OrxonoxExport PawnListener : virtual public OrxonoxClass |
---|
[2485] | 136 | { |
---|
| 137 | friend class Pawn; |
---|
| 138 | |
---|
| 139 | public: |
---|
| 140 | PawnListener(); |
---|
| 141 | virtual ~PawnListener() {} |
---|
| 142 | |
---|
| 143 | protected: |
---|
| 144 | virtual void destroyedPawn(Pawn* pawn) = 0; |
---|
| 145 | }; |
---|
[2072] | 146 | } |
---|
| 147 | |
---|
| 148 | #endif /* _Pawn_H__ */ |
---|