Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/playability/src/world_entities/space_ships/space_ship.h @ 9963

Last change on this file since 9963 was 9963, checked in by nicolasc, 17 years ago

Add armorRegen for bioships (—> Zergs for starcraft); updated regen function to check if *regen is available

File size: 6.0 KB
Line 
1/*!
2 * @file space_ship.h
3 * Implements the Control of a Spaceship
4 * Space Ships are the core class for all types of ships in Orxonox
5 */
6
7#ifndef _SPACE_SHIP_H
8#define _SPACE_SHIP_H
9
10#include "playable.h"
11#include "extendable.h"
12
13// Forward Declaration
14template<class T> class tList;
15class Vector;
16class Event;
17class ParticleEmitter;
18class ParticleSystem;
19
20class SpaceShip : public Playable
21{
22  ObjectListDeclaration(SpaceShip);
23
24  public:
25    SpaceShip(const std::string& fileName);
26    SpaceShip(const TiXmlElement* root = NULL);
27    virtual ~SpaceShip();
28
29    virtual void loadParams(const TiXmlElement* root);
30
31    virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f);
32
33    virtual void enter();
34    virtual void leave();
35
36    virtual void reset();
37
38    virtual void postSpawn();
39    virtual void leftWorld();
40
41    virtual void destroy(WorldEntity* killer);
42    virtual void respawn();
43
44    virtual void collidesWith(WorldEntity* entity, const Vector& location);
45    virtual void tick(float time);
46    virtual void draw() const;
47
48    virtual void process(const Event &event);
49
50    //Functions for GUI
51    inline float getShieldCur() { return this->shieldCur; };        //!< returns current shield value
52    inline float getShieldMax() { return this->shieldMax; };        //!< returns maximum shield value
53
54    inline float getArmorCur() { return this->armorCur; };          //!< returns current armor value
55    inline float getArmorMax() { return this->armorMax; };          //!< returns current armor value
56
57    inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value
58    inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value
59
60    //damage handler
61    virtual void damage(float pDamage, float eDamage);  //!< pDamage physical damage, eDamage electronic damage
62
63  private:
64    void init();
65
66    void calculateVelocity(float time);
67
68    void regen(float time);  //!< handler for shield and electronic regeneration
69
70    WeaponManager         primWeaponMan;      //!< the primary weapon manager: managing a list of energy weapons to wepaon-slot mapping
71    WeaponManager         secWeaponMan;       //!< the secondary weapon manager: managing a list of special weapons to weapon-slot mapping
72    short                 supportedPlaymodes; //!< What Playmodes are Supported in this Playable.
73    Playable::Playmode    playmode;           //!< The current playmode.
74    bool                  bPrimFire;
75    bool                  bSecFire;
76
77    //ship atributes
78    float       shieldCur;          //!< current shield
79    float       shieldMax;          //!< maximum shield
80    float       shieldEnergyShare;  //!< percentage of reactor output
81    float       shieldRegen;        //!< shield regeneration rate per tick
82    float       shieldTH;           //!< shield threshhold for reactivation
83    bool        shieldActive;       //!< wheather the shield is working
84
85    float       armorCur;           //!< current armor
86    float       armorMax;           //!< maximum armor
87    float       armorRegen;         //!< armor regeneration per tick (usable on bioships?)
88
89    float       electronicCur;      //!< current electronic
90    float       electronicMax;      //!< maximum electronic
91    float       electronicRegen;    //!< electronic regenration rate per tick
92
93    int         engineSpeedCur;     //!< speed output
94    int         enginePowerConsume; //!< energy needed
95    float       engineEnergyShare;  //!< percentage of reactor output
96
97    int         weaponEnergySlot;   //!< number of energy weapon slots
98    int         weaponEnergyUsed;
99    float       weaponEnergyShare;
100    int         weaponSpecialSlot;  //!< number of special weapon slots
101    int         weaponSpecialUsed;
102
103    int         reactorOutput;      //!< reactor output
104    int         reactorCapacity;    //!< reactor capacity
105
106
107    int         curWeaponPrimary;   //!< current primary weapon config
108    int         curWeaponSecondary; //!< current secondary weapon config
109
110    bool                  bUp;                //!< up button pressed.
111    bool                  bDown;              //!< down button pressed.
112    bool                  bLeft;              //!< left button pressed.
113    bool                  bRight;             //!< right button pressed.
114    bool                  bAscend;            //!< ascend button pressed.
115    bool                  bDescend;           //!< descend button presses.
116//    bool                  bFire;              //!< fire button pressed.(moved to playable)
117    bool                  bRollL;             //!< rolling button pressed (left)
118    bool                  bRollR;             //!< rolling button pressed (right)
119
120    float                 xMouse;             //!< mouse moved in x-Direction
121    float                 yMouse;             //!< mouse moved in y-Direction
122    float                 mouseSensitivity;   //!< the mouse sensitivity
123    int                   yInvert;
124    int                   controlVelocityX;
125    int                   controlVelocityY;
126//    float                 cycle;              //!< hovercycle
127
128    Vector                velocity;           //!< the velocity of the player.
129    Vector                oldVelocity;        //!< the velocity the player had last synced
130    Quaternion            mouseDir;           //!< the direction where the player wants to fly
131    Quaternion            oldMouseDir;        //!< the direction where the player wanted to fly
132    float                 shipInertia;        //!< the inertia of the ship(how fast the ship reacts to a mouse input)
133    Quaternion            rotQuat;
134    Quaternion            pitchDir;
135    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
136    float                 acceleration;       //!< the acceleration of the player.
137
138    float                 airViscosity;
139
140    byte                  oldMask;            //!< used for synchronisation
141
142    ParticleEmitter*      burstEmitter;
143    ParticleSystem*       burstSystem;
144};
145
146#endif /* _SPACE_SHIPS_H */
Note: See TracBrowser for help on using the repository browser.