Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

some getAttr for GUI, damage and shield handlers

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