Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 19, 2005, 4:59:58 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: brought logic to the execution-cycle.
There are now some subfunction fireW() that sets all the properties needed for a shoot, and then the extension (derived class) can define the Fire function itself

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/weapons/weapon.h

    r4891 r4892  
    1919#define _WEAPON_H
    2020
    21 #include "base_object.h"
    2221#include "world_entity.h"
    2322
     
    9190    Projectile* getProjectile() { return this->projectile; };
    9291
     92    void setEmissionPoint(const Vector& point);
     93    /** @see void setEmissionPoint(const Vector& point); */
     94    inline void setEmissionPoint(float x, float y, float z) { this->setEmissionPoint(Vector(x,y,z)); };
     95
    9396    /** @param state the State to time @param duration the duration of the State */
    9497    inline void setStateDuration(const char* state, float duration) { setStateDuration(charToState(state), duration); };
     
    101104    /** @returns the current State of the Weapon */
    102105    inline WeaponState getCurrentState() const { return this->currentState; };
     106
    103107    /** @param energyMax the maximum energy the Weapon can have @param energyLoadedMax the maximum energy in the weapon buffers */
    104108    inline void setMaximumEnergy(float energyMax, float energyLoadedMax = 0.0) { this->energyMax = energyMax; this->energyLoadedMax = energyLoadedMax; };
     
    108112    void setActionSound(const char* action, const char* soundFile) { this->setActionSound(charToAction(action), soundFile); };
    109113
    110     virtual void destroy();
    111114
    112115
     
    120123  protected:
    121124    //! ACTION: these functions are handled by the Weapon itself, and must be called by requestAction(WeaponAction);
    122     bool execute();
    123     virtual void activate();
    124     virtual void deactivate();
    125     virtual void fire();
    126     virtual void reload();
    127     virtual void charge();
     125    virtual void activate() {};
     126    virtual void deactivate() {};
     127    virtual void charge() {};
     128    virtual void fire() {};
     129    virtual void reload() {};
     130    virtual void destroy() {};
    128131
    129132
     
    136139
    137140  private:
     141    /** executive functions, that handle timing with actions.
     142     * This is for the action-functions in derived functions to be easy
     143     * The main function is execute, that calls all the other functions
     144     * for being fast, the Functions are private and as such will be inlined
     145     * into the execute function. (this is work of the compiler)
     146     */
     147    bool execute();
     148    bool activateW();
     149    bool deactivateW();
     150    bool chargeW();
     151    bool fireW();
     152    bool reloadW();
     153
    138154    bool nextActionValid() const;
    139155
     
    161177    SoundBuffer*         soundBuffers[WA_ACTION_COUNT];    //!< SoundBuffers for all actions @see WeaponAction.
    162178
     179    PNode                emissionPoint;                   //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)
    163180
    164181    bool                 active;                          //!< states wheter the weapon is enabled or not
Note: See TracChangeset for help on using the changeset viewer.