Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/playable.h @ 6436

Last change on this file since 6436 was 6436, checked in by bensch, 18 years ago

orxonox/trunk: collides with function now takes away the Energy of our beloved Entity

File size: 1.5 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 "event.h"
11#include <list>
12
13class Weapon;
14class WeaponManager;
15class Player;
16
17//! Basic controllable WorldEntity
18/**
19 *
20 */
21class Playable : public WorldEntity
22{
23  public:
24    Playable();
25    virtual ~Playable();
26
27    virtual void enter()=0;
28    virtual void leave()=0;
29
30    virtual void addWeapon(Weapon* weapon )  {}//= 0;
31    virtual void removeWeapon(Weapon* weapon) {}//= 0;
32    inline WeaponManager* getWeaponManager() const { return this->weaponMan; };
33
34    bool subscribePlayer(Player* player);
35    bool unsubscribePlayer(Player* player);
36
37    void attachCamera();
38    void detachCamera();
39
40    virtual void collidesWith(WorldEntity* entity, const Vector& location);
41    virtual void process(const Event &event) = 0;
42
43
44
45    /** @return a List of Events in PEV_* sytle */
46    inline const std::list<int>& getEventList() { return this->events; };
47
48  protected:
49    void registerEvent(int eventType);
50    void unregisterEvent(int eventType);
51
52  private:
53    void init();
54
55  private:
56    WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
57    std::list<int>        events;             //!< A list of Events, that are captured for this playable
58
59    Player*               currentPlayer;      //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL
60
61};
62
63#endif /* _PLAYABLE_H */
Note: See TracBrowser for help on using the repository browser.