Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6985 was 6966, checked in by patrick, 19 years ago

trunk: deactivated the lenseflare temp

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