Last change
on this file since 6485 was
6444,
checked in by bensch, 19 years ago
|
trunk: sliders get updated, as they should be
|
File size:
1.6 KB
|
Rev | Line | |
---|
[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" |
---|
| 10 | #include "event.h" |
---|
[5876] | 11 | #include <list> |
---|
[5838] | 12 | |
---|
[6444] | 13 | #include "world_entities/weapons/weapon_manager.h" |
---|
[6442] | 14 | |
---|
[5847] | 15 | class Weapon; |
---|
[6444] | 16 | |
---|
[5872] | 17 | class Player; |
---|
[5838] | 18 | |
---|
| 19 | //! Basic controllable WorldEntity |
---|
| 20 | /** |
---|
[5864] | 21 | * |
---|
[5838] | 22 | */ |
---|
| 23 | class Playable : public WorldEntity |
---|
| 24 | { |
---|
| 25 | public: |
---|
| 26 | Playable(); |
---|
| 27 | virtual ~Playable(); |
---|
| 28 | |
---|
[6241] | 29 | virtual void enter()=0; |
---|
| 30 | virtual void leave()=0; |
---|
[5838] | 31 | |
---|
[6443] | 32 | void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1); |
---|
| 33 | void removeWeapon(Weapon* weapon); |
---|
[6444] | 34 | void nextWeaponConfig(); |
---|
| 35 | void previousWeaponConfig(); |
---|
[6443] | 36 | |
---|
[5875] | 37 | inline WeaponManager* getWeaponManager() const { return this->weaponMan; }; |
---|
[5838] | 38 | |
---|
[5895] | 39 | bool subscribePlayer(Player* player); |
---|
[5896] | 40 | bool unsubscribePlayer(Player* player); |
---|
[5895] | 41 | |
---|
[6241] | 42 | void attachCamera(); |
---|
| 43 | void detachCamera(); |
---|
| 44 | |
---|
[6436] | 45 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
[5898] | 46 | virtual void process(const Event &event) = 0; |
---|
| 47 | |
---|
| 48 | |
---|
[6222] | 49 | |
---|
[5898] | 50 | /** @return a List of Events in PEV_* sytle */ |
---|
[5877] | 51 | inline const std::list<int>& getEventList() { return this->events; }; |
---|
[5838] | 52 | |
---|
[5877] | 53 | protected: |
---|
| 54 | void registerEvent(int eventType); |
---|
[5895] | 55 | void unregisterEvent(int eventType); |
---|
[5872] | 56 | |
---|
[5838] | 57 | private: |
---|
| 58 | WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping |
---|
[5898] | 59 | std::list<int> events; //!< A list of Events, that are captured for this playable |
---|
[5886] | 60 | |
---|
[5898] | 61 | Player* currentPlayer; //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL |
---|
[5888] | 62 | |
---|
[5838] | 63 | }; |
---|
| 64 | |
---|
| 65 | #endif /* _PLAYABLE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.