Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/avi_play/src/world_entities/playable.h @ 7134

Last change on this file since 7134 was 7044, checked in by patrick, 19 years ago

trunk: death screen now works

File size: 2.4 KB
Line 
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"
10#include "extendable.h"
11#include "event.h"
12#include <list>
13
14#include "world_entities/weapons/weapon_manager.h"
15
16class Weapon;
17class DotEmitter;
18class Player;
19class SpriteParticles;
20
21//! Basic controllable WorldEntity
22/**
23 *
24 */
25class Playable : public WorldEntity, public Extendable
26{
27  public:
28    virtual ~Playable();
29
30
31    virtual void die();
32    virtual void respawn();
33
34    virtual bool pickup(PowerUp* powerUp);
35
36    void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
37    void removeWeapon(Weapon* weapon);
38    void nextWeaponConfig();
39    void previousWeaponConfig();
40
41    inline WeaponManager* getWeaponManager() const { return this->weaponMan; };
42    void weaponConfigChanged();
43
44
45    bool setPlayer(Player* player);
46    Player* getCurrentPlayer() const { return this->currentPlayer; };
47
48    void attachCamera();
49    void detachCamera();
50
51    virtual void collidesWith(WorldEntity* entity, const Vector& location);
52    virtual void process(const Event &event);
53
54    virtual void tick(float dt);
55
56    /** @return a List of Events in PEV_* sytle */
57    inline const std::list<int>& getEventList() { return this->events; };
58
59    int       writeSync(const byte* data, int length, int sender);
60    int       readSync(byte* data, int maxLength );
61    bool      needsReadSync();
62
63    inline void setScore( int score ) { this->score = score; }
64    inline int  getScore() { return this->score; }
65
66  protected:
67    Playable();
68
69    virtual void enter() = 0;
70    virtual void leave() = 0;
71
72    void registerEvent(int eventType);
73    void unregisterEvent(int eventType);
74
75  private:
76    WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
77    std::list<int>        events;             //!< A list of Events, that are captured for this playable
78
79    Player*               currentPlayer;      //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL
80
81    bool                  bFire;              //!< If the Ship is firing.
82    int                   oldFlags;           //!< Used for synchronisation
83
84    int                   score;
85    int                   oldScore;
86
87    //TODO HACK: explosion emitter
88    DotEmitter*           emitter;
89    SpriteParticles*      explosionParticles;
90};
91
92#endif /* _PLAYABLE_H */
Note: See TracBrowser for help on using the repository browser.