Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/powerups/src/world_entities/playable.h @ 6946

Last change on this file since 6946 was 6871, checked in by bensch, 19 years ago

orxonox/trunk: small fixes (cleanup)

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