/*! * @file playable.h * Interface for a basic controllable WorldEntity */ #ifndef _PLAYABLE_H #define _PLAYABLE_H #include "world_entity.h" #include "extendable.h" #include "event.h" #include #include "world_entities/weapons/weapon_manager.h" class Weapon; class Player; //! Basic controllable WorldEntity /** * */ class Playable : public WorldEntity, public Extendable { public: Playable(); virtual ~Playable(); virtual void enter()=0; virtual void leave()=0; virtual bool pickup(PowerUp* powerUp); void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1); void removeWeapon(Weapon* weapon); void nextWeaponConfig(); void previousWeaponConfig(); inline WeaponManager* getWeaponManager() const { return this->weaponMan; }; void weaponConfigChanged(); bool subscribePlayer(Player* player); bool unsubscribePlayer(Player* player); void attachCamera(); void detachCamera(); virtual void collidesWith(WorldEntity* entity, const Vector& location); virtual void process(const Event &event) = 0; /** @return a List of Events in PEV_* sytle */ inline const std::list& getEventList() { return this->events; }; protected: void registerEvent(int eventType); void unregisterEvent(int eventType); private: WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping std::list events; //!< A list of Events, that are captured for this playable Player* currentPlayer; //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL }; #endif /* _PLAYABLE_H */