Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7051 was 7044, checked in by patrick, 19 years ago

trunk: death screen now works

File size: 2.4 KB
RevLine 
[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]16class Weapon;
[6959]17class DotEmitter;
[5872]18class Player;
[6959]19class SpriteParticles;
[5838]20
21//! Basic controllable WorldEntity
22/**
[5864]23 *
[5838]24 */
[6547]25class Playable : public WorldEntity, public Extendable
[5838]26{
27  public:
28    virtual ~Playable();
29
30
[6966]31    virtual void die();
[7044]32    virtual void respawn();
[6966]33
[6547]34    virtual bool pickup(PowerUp* powerUp);
35
[6443]36    void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
37    void removeWeapon(Weapon* weapon);
[6444]38    void nextWeaponConfig();
39    void previousWeaponConfig();
[6443]40
[5875]41    inline WeaponManager* getWeaponManager() const { return this->weaponMan; };
[6568]42    void weaponConfigChanged();
[5838]43
[6568]44
[6986]45    bool setPlayer(Player* player);
46    Player* getCurrentPlayer() const { return this->currentPlayer; };
[5895]47
[6241]48    void attachCamera();
49    void detachCamera();
50
[6436]51    virtual void collidesWith(WorldEntity* entity, const Vector& location);
[6804]52    virtual void process(const Event &event);
[5898]53
[6804]54    virtual void tick(float dt);
[5898]55
56    /** @return a List of Events in PEV_* sytle */
[5877]57    inline const std::list<int>& getEventList() { return this->events; };
[6871]58
[6868]59    int       writeSync(const byte* data, int length, int sender);
60    int       readSync(byte* data, int maxLength );
61    bool      needsReadSync();
[6966]62
[6959]63    inline void setScore( int score ) { this->score = score; }
64    inline int  getScore() { return this->score; }
[5838]65
[5877]66  protected:
[6804]67    Playable();
68
[6986]69    virtual void enter() = 0;
70    virtual void leave() = 0;
71
[5877]72    void registerEvent(int eventType);
[5895]73    void unregisterEvent(int eventType);
[5872]74
[5838]75  private:
76    WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
[5898]77    std::list<int>        events;             //!< A list of Events, that are captured for this playable
[5886]78
[5898]79    Player*               currentPlayer;      //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL
[5888]80
[6804]81    bool                  bFire;              //!< If the Ship is firing.
[6868]82    int                   oldFlags;           //!< Used for synchronisation
[6966]83
[6959]84    int                   score;
85    int                   oldScore;
[6804]86
[6994]87    //TODO HACK: explosion emitter
[6959]88    DotEmitter*           emitter;
89    SpriteParticles*      explosionParticles;
[5838]90};
91
92#endif /* _PLAYABLE_H */
Note: See TracBrowser for help on using the repository browser.