Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6487 was 6487, checked in by manuel, 19 years ago

moved pickup from spaceship to playable. playable can now pickup health and max-health powerups

File size: 1.7 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    Playable();
28    virtual ~Playable();
29
30    virtual void enter()=0;
31    virtual void leave()=0;
32
33    virtual bool pickup(PowerUp* powerUp);
34
35    void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
36    void removeWeapon(Weapon* weapon);
37    void nextWeaponConfig();
38    void previousWeaponConfig();
39
40    inline WeaponManager* getWeaponManager() const { return this->weaponMan; };
41
42    bool subscribePlayer(Player* player);
43    bool unsubscribePlayer(Player* player);
44
45    void attachCamera();
46    void detachCamera();
47
48    virtual void collidesWith(WorldEntity* entity, const Vector& location);
49    virtual void process(const Event &event) = 0;
50
51
52
53    /** @return a List of Events in PEV_* sytle */
54    inline const std::list<int>& getEventList() { return this->events; };
55
56  protected:
57    void registerEvent(int eventType);
58    void unregisterEvent(int eventType);
59
60  private:
61    WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
62    std::list<int>        events;             //!< A list of Events, that are captured for this playable
63
64    Player*               currentPlayer;      //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL
65
66};
67
68#endif /* _PLAYABLE_H */
Note: See TracBrowser for help on using the repository browser.