/*! * @file space_ship.h * Implements the Control of a Spaceship * Space Ships are the core class for all types of ships in Orxonox */ #ifndef _SPACE_SHIP_H #define _SPACE_SHIP_H #include "playable.h" #include "extendable.h" // Forward Declaration template class tList; class Vector; class Event; class ParticleEmitter; class ParticleSystem; class SpaceShip : public Playable { ObjectListDeclaration(SpaceShip); public: SpaceShip(const std::string& fileName); SpaceShip(const TiXmlElement* root = NULL); virtual ~SpaceShip(); virtual void loadParams(const TiXmlElement* root); virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); virtual void enter(); virtual void leave(); virtual void reset(); virtual void postSpawn(); virtual void leftWorld(); virtual void destroy(WorldEntity* killer); virtual void respawn(); virtual void collidesWith(WorldEntity* entity, const Vector& location); virtual void tick(float time); virtual void draw() const; virtual void process(const Event &event); //Functions for GUI inline float getShieldCur() { return this->shieldCur; }; //!< returns current shield value inline float getShieldMax() { return this->shieldMax; }; //!< returns maximum shield value inline float getArmorCur() { return this->armorCur; }; //!< returns current armor value inline float getArmorMax() { return this->armorMax; }; //!< returns current armor value inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value inline int getFiredWeapon() { return this->firedWeapon; }; //!< returns index of the fired weapon //damage handler virtual void damage(float pDamage, float eDamage); //!< pDamage physical damage, eDamage electronic damage private: void init(); void calculateVelocity(float time); void regen(float time); //!< handler for shield and electronic regeneration //ship atributes float shieldCur; //!< current shield float shieldMax; //!< maximum shield float shieldEnergyShare; //!< percentage of reactor output float shieldRegen; //!< shield regeneration rate per tick float shieldTH; //!< shield threshhold for reactivation bool shieldActive; //!< wheather the shield is working float armorCur; //!< current armor float armorMax; //!< maximum armor float electronicCur; //!< current electronic float electronicMax; //!< maximum electronic float electronicRegen; //!< electronic regenration rate per tick int engineSpeedCur; //!< speed output int enginePowerConsume; //!< energy needed float engineEnergyShare; //!< percentage of reactor output int weaponEnergySlot; //!< number of energy weapon slots int weaponEnergyUsed; float weaponEnergyShare; int weaponSpecialSlot; //!< number of special weapon slots int weaponSpecialUsed; int reactorOutput; //!< reactor output int reactorCapacity; //!< reactor capacity int curWeaponPrimary; //!< current primary weapon int curWeaponSecondary; //!< current secondary weapon int firedWeapon; //!< index of the fired weapon for the weapon manager bool bUp; //!< up button pressed. bool bDown; //!< down button pressed. bool bLeft; //!< left button pressed. bool bRight; //!< right button pressed. bool bAscend; //!< ascend button pressed. bool bDescend; //!< descend button presses. // bool bFire; //!< fire button pressed.(moved to playable) bool bRollL; //!< rolling button pressed (left) bool bRollR; //!< rolling button pressed (right) float xMouse; //!< mouse moved in x-Direction float yMouse; //!< mouse moved in y-Direction float mouseSensitivity; //!< the mouse sensitivity int yInvert; int controlVelocityX; int controlVelocityY; // float cycle; //!< hovercycle Vector velocity; //!< the velocity of the player. Vector oldVelocity; //!< the velocity the player had last synced Quaternion mouseDir; //!< the direction where the player wants to fly Quaternion oldMouseDir; //!< the direction where the player wanted to fly float shipInertia; //!< the inertia of the ship(how fast the ship reacts to a mouse input) Quaternion rotQuat; Quaternion pitchDir; float travelSpeed; //!< the current speed of the player (to make soft movement) float acceleration; //!< the acceleration of the player. float airViscosity; byte oldMask; //!< used for synchronisation ParticleEmitter* burstEmitter; ParticleSystem* burstSystem; }; #endif /* _SPACE_SHIPS_H */