[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] | 16 | class Weapon; |
---|
[6444] | 17 | |
---|
[5872] | 18 | class Player; |
---|
[5838] | 19 | |
---|
| 20 | //! Basic controllable WorldEntity |
---|
| 21 | /** |
---|
[5864] | 22 | * |
---|
[5838] | 23 | */ |
---|
[6547] | 24 | class Playable : public WorldEntity, public Extendable |
---|
[5838] | 25 | { |
---|
| 26 | public: |
---|
| 27 | virtual ~Playable(); |
---|
| 28 | |
---|
[6241] | 29 | virtual void enter()=0; |
---|
| 30 | virtual void leave()=0; |
---|
[5838] | 31 | |
---|
[6547] | 32 | virtual bool pickup(PowerUp* powerUp); |
---|
| 33 | |
---|
[6443] | 34 | void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1); |
---|
| 35 | void removeWeapon(Weapon* weapon); |
---|
[6444] | 36 | void nextWeaponConfig(); |
---|
| 37 | void previousWeaponConfig(); |
---|
[6443] | 38 | |
---|
[5875] | 39 | inline WeaponManager* getWeaponManager() const { return this->weaponMan; }; |
---|
[6568] | 40 | void weaponConfigChanged(); |
---|
[5838] | 41 | |
---|
[6568] | 42 | |
---|
[5895] | 43 | bool subscribePlayer(Player* player); |
---|
[5896] | 44 | bool unsubscribePlayer(Player* player); |
---|
[5895] | 45 | |
---|
[6241] | 46 | void attachCamera(); |
---|
| 47 | void detachCamera(); |
---|
| 48 | |
---|
[6436] | 49 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
[6804] | 50 | virtual void process(const Event &event); |
---|
[5898] | 51 | |
---|
[6804] | 52 | virtual void tick(float dt); |
---|
[5898] | 53 | |
---|
| 54 | /** @return a List of Events in PEV_* sytle */ |
---|
[5877] | 55 | inline const std::list<int>& getEventList() { return this->events; }; |
---|
[5838] | 56 | |
---|
[5877] | 57 | protected: |
---|
[6804] | 58 | Playable(); |
---|
| 59 | |
---|
[5877] | 60 | void registerEvent(int eventType); |
---|
[5895] | 61 | void unregisterEvent(int eventType); |
---|
[5872] | 62 | |
---|
[5838] | 63 | private: |
---|
| 64 | WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping |
---|
[5898] | 65 | std::list<int> events; //!< A list of Events, that are captured for this playable |
---|
[5886] | 66 | |
---|
[5898] | 67 | Player* currentPlayer; //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL |
---|
[5888] | 68 | |
---|
[6804] | 69 | bool bFire; //!< If the Ship is firing. |
---|
| 70 | |
---|
[5838] | 71 | }; |
---|
| 72 | |
---|
| 73 | #endif /* _PLAYABLE_H */ |
---|