Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/playable.h @ 7220

Last change on this file since 7220 was 7173, checked in by bensch, 19 years ago

trunk: minor

File size: 2.7 KB
RevLine 
[5838]1
2/*!
3 * @file playable.h
4 * Interface for a basic controllable WorldEntity
5 */
6#ifndef _PLAYABLE_H
7#define _PLAYABLE_H
8
9#include "world_entity.h"
[6547]10#include "extendable.h"
[5838]11#include "event.h"
[5876]12#include <list>
[5838]13
[6444]14#include "world_entities/weapons/weapon_manager.h"
[6442]15
[5847]16class Weapon;
[6959]17class DotEmitter;
[5872]18class Player;
[6959]19class SpriteParticles;
[7118]20class Explosion;
[5838]21
22//! Basic controllable WorldEntity
23/**
[5864]24 *
[5838]25 */
[6547]26class Playable : public WorldEntity, public Extendable
[5838]27{
28  public:
29    virtual ~Playable();
30
[7092]31    virtual void loadParams(const TiXmlElement* root);
[5838]32
[6966]33    virtual void die();
[7044]34    virtual void respawn();
[6966]35
[6547]36    virtual bool pickup(PowerUp* powerUp);
37
[6443]38    void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
39    void removeWeapon(Weapon* weapon);
[6444]40    void nextWeaponConfig();
41    void previousWeaponConfig();
[6443]42
[5875]43    inline WeaponManager* getWeaponManager() const { return this->weaponMan; };
[6568]44    void weaponConfigChanged();
[5838]45
[6568]46
[6986]47    bool setPlayer(Player* player);
48    Player* getCurrentPlayer() const { return this->currentPlayer; };
[5895]49
[6241]50    void attachCamera();
51    void detachCamera();
[7173]52    virtual void setCameraMode(unsigned int cameraMode = 0);
[6241]53
[6436]54    virtual void collidesWith(WorldEntity* entity, const Vector& location);
[6804]55    virtual void process(const Event &event);
[5898]56
[6804]57    virtual void tick(float dt);
[5898]58
59    /** @return a List of Events in PEV_* sytle */
[5877]60    inline const std::list<int>& getEventList() { return this->events; };
[6871]61
[6868]62    int       writeSync(const byte* data, int length, int sender);
63    int       readSync(byte* data, int maxLength );
64    bool      needsReadSync();
[6966]65
[7092]66
67    virtual void setAbsDirPlay(const Quaternion& rot) = 0;
68    void setAbsDirPlay(float angle, float dirX, float dirY, float dirZ) { this->setAbsDirPlay(Quaternion(angle, Vector(dirX, dirY, dirZ))); }
69
[6959]70    inline void setScore( int score ) { this->score = score; }
71    inline int  getScore() { return this->score; }
[5838]72
[5877]73  protected:
[6804]74    Playable();
75
[6986]76    virtual void enter() = 0;
77    virtual void leave() = 0;
78
[5877]79    void registerEvent(int eventType);
[5895]80    void unregisterEvent(int eventType);
[5872]81
[5838]82  private:
83    WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
[5898]84    std::list<int>        events;             //!< A list of Events, that are captured for this playable
[5886]85
[5898]86    Player*               currentPlayer;      //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL
[5888]87
[6804]88    bool                  bFire;              //!< If the Ship is firing.
[6868]89    int                   oldFlags;           //!< Used for synchronisation
[6966]90
[6959]91    int                   score;
92    int                   oldScore;
[6804]93
[7118]94    bool                  bDead;
95
[6994]96    //TODO HACK: explosion emitter
[7072]97
[7118]98
[7072]99    WorldEntity* collider;
[5838]100};
101
102#endif /* _PLAYABLE_H */
Note: See TracBrowser for help on using the repository browser.