Changeset 4878 in orxonox.OLD for orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.h
- Timestamp:
- Jul 17, 2005, 12:37:18 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.h
r4876 r4878 78 78 void loadParams(const TiXmlElement* root); 79 79 80 void enable();81 void disable();82 bool isEnabled();83 84 80 void setProjectile(Projectile* projectile); 85 81 Projectile* getProjectile(); … … 87 83 virtual void activate(); 88 84 virtual void deactivate(); 89 bool isActive(); 85 virtual void fire() = 0; 86 //virtual void reload(); 87 //virtual void charge(); 88 bool isActive() const { return this->active; }; 90 89 91 92 /** @param idle time in ms */ 93 inline void setWeaponIdleTime(float idleTime) { this->idleTime = idleTime; }; 94 /** @returns idle time in ms */ 95 inline float getWeaponIdleTime() const { return this->idleTime; }; 96 /** @return true if idletime is elapsed else otherwise */ 97 inline bool hasWeaponIdleTimeElapsed() const { return (this->localTime > this->idleTime)?true:false; }; 90 // FUNCTIONS TO SET THE WEAPONS PROPERTIES. 91 void setStateDuration(const char* state, float duration); 92 void setStateDuration(WeaponState state, float duration); 93 float getStateDuration(WeaponState state) { return (state < WS_STATE_COUNT)?this->times[state]:0.0; }; 94 /** @return true if idletime is elapsed, false otherwise */ 95 inline bool stateTimeElapsed() const { return (this->stateTime > this->times[currentState])?true:false; }; 98 96 99 97 /** fires the weapon */ 100 virtual void fire() = 0;101 98 virtual void hit (WorldEntity* weapon, const Vector& loc); 102 99 virtual void destroy(); … … 107 104 108 105 protected: 109 float localTime; //<! this is the local time. important for shooting attributes like frequency110 float idleTime; //<! the time a weapon needs before it can shoot again. eg. shooting frequency or actication/deactivateion delay111 float slowDownFactor; //<! if the shooting frequency is a linear function of time...112 113 106 //////////// 114 107 // PHASES // 115 108 //////////// 116 109 WeaponState currentState; //!< The State the weapon is in. 117 float stateTime; //!< how long the state has t eken until now.110 float stateTime; //!< how long the state has taken until now. 118 111 float times[WS_STATE_COUNT]; //!< Times to stay in the different States @see WeaponState. 119 112 SoundBuffer* soundBuffers[WA_ACTION_COUNT]; //!< SoundBuffers for all actions @see WeaponAction. … … 127 120 128 121 private: 129 bool enabled; //<! states if the weapon is enabled or not 130 Projectile* projectile; //<! the projectile used for this weapon 131 //WeaponSound sound; 122 bool active; //!< states wheter the weapon is enabled or not 123 Projectile* projectile; //!< the projectile used for this weapon 132 124 }; 133 125
Note: See TracChangeset
for help on using the changeset viewer.