Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9958 was 9958, checked in by marcscha, 18 years ago

Inline of damage get on projectile, part implementation of primary - secondary weapon and handling variables for the weapon manager

File size: 5.6 KB
RevLine 
[7346]1/*!
2 * @file space_ship.h
3 * Implements the Control of a Spaceship
[9958]4 * Space Ships are the core class for all types of ships in Orxonox
[7346]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{
[9869]22  ObjectListDeclaration(SpaceShip);
[7346]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();
[9869]40
[9235]41    virtual void destroy(WorldEntity* killer);
[9008]42    virtual void respawn();
[7346]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
[9950]50    //Functions for GUI
[9957]51    inline float getShieldCur() { return this->shieldCur; };        //!< returns current shield value
52    inline float getShieldMax() { return this->shieldMax; };        //!< returns maximum shield value
[9950]53
[9957]54    inline float getArmorCur() { return this->armorCur; };          //!< returns current armor value
55    inline float getArmorMax() { return this->armorMax; };          //!< returns current armor value
[9950]56
[9957]57    inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value
58    inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value
[9950]59
[9958]60    inline int getFiredWeapon() { return this->firedWeapon; };      //!< returns index of the fired weapon
61
[9950]62    //damage handler
[9957]63    virtual void damage(float pDamage, float eDamage);  //!< pDamage physical damage, eDamage electronic damage
[9950]64
[7346]65  private:
66    void init();
67
68    void calculateVelocity(float time);
69
[9957]70    void regen(float time);  //!< handler for shield and electronic regeneration
[9943]71
[9950]72    //ship atributes
[9957]73    float       shieldCur;          //!< current shield
74    float       shieldMax;          //!< maximum shield
[9950]75    float       shieldEnergyShare;  //!< percentage of reactor output
[9957]76    float       shieldRegen;        //!< shield regeneration rate per tick
77    float       shieldTH;           //!< shield threshhold for reactivation
[9950]78    bool        shieldActive;       //!< wheather the shield is working
[9943]79
[9957]80    float       armorCur;           //!< current armor
81    float       armorMax;           //!< maximum armor
[9943]82
[9957]83    float       electronicCur;      //!< current electronic
84    float       electronicMax;      //!< maximum electronic
85    float       electronicRegen;    //!< electronic regenration rate per tick
[9943]86
[9950]87    int         engineSpeedCur;     //!< speed output
88    int         enginePowerConsume; //!< energy needed
89    float       engineEnergyShare;  //!< percentage of reactor output
[9943]90
[9950]91    int         weaponEnergySlot;   //!< number of energy weapon slots
92    int         weaponEnergyUsed;
93    float       weaponEnergyShare;
94    int         weaponSpecialSlot;  //!< number of special weapon slots
95    int         weaponSpecialUsed;
[9943]96
[9950]97    int         reactorOutput;      //!< reactor output
98    int         reactorCapacity;    //!< reactor capacity
[9943]99
[9958]100
101    int         curWeaponPrimary;   //!< current primary weapon
102    int         curWeaponSecondary; //!< current secondary weapon
103    int         firedWeapon;        //!< index of the fired weapon for the weapon manager
104
[7346]105    bool                  bUp;                //!< up button pressed.
106    bool                  bDown;              //!< down button pressed.
107    bool                  bLeft;              //!< left button pressed.
108    bool                  bRight;             //!< right button pressed.
109    bool                  bAscend;            //!< ascend button pressed.
110    bool                  bDescend;           //!< descend button presses.
111//    bool                  bFire;              //!< fire button pressed.(moved to playable)
112    bool                  bRollL;             //!< rolling button pressed (left)
113    bool                  bRollR;             //!< rolling button pressed (right)
114
115    float                 xMouse;             //!< mouse moved in x-Direction
116    float                 yMouse;             //!< mouse moved in y-Direction
117    float                 mouseSensitivity;   //!< the mouse sensitivity
118    int                   yInvert;
119    int                   controlVelocityX;
120    int                   controlVelocityY;
121//    float                 cycle;              //!< hovercycle
122
123    Vector                velocity;           //!< the velocity of the player.
124    Vector                oldVelocity;        //!< the velocity the player had last synced
125    Quaternion            mouseDir;           //!< the direction where the player wants to fly
126    Quaternion            oldMouseDir;        //!< the direction where the player wanted to fly
127    float                 shipInertia;        //!< the inertia of the ship(how fast the ship reacts to a mouse input)
128    Quaternion            rotQuat;
129    Quaternion            pitchDir;
130    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
131    float                 acceleration;       //!< the acceleration of the player.
132
133    float                 airViscosity;
134
135    byte                  oldMask;            //!< used for synchronisation
136
137    ParticleEmitter*      burstEmitter;
138    ParticleSystem*       burstSystem;
139};
140
141#endif /* _SPACE_SHIPS_H */
Note: See TracBrowser for help on using the repository browser.