Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/world_entities/playable.h @ 7444

Last change on this file since 7444 was 7444, checked in by rennerc, 18 years ago

new network system implemented. yet with a lot of empty function bodys

File size: 3.7 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"
[7338]12#include <vector>
[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;
[7118]20class Explosion;
[5838]21
22//! Basic controllable WorldEntity
23/**
[5864]24 *
[5838]25 */
[6547]26class Playable : public WorldEntity, public Extendable
[5838]27{
[7338]28public:
[7346]29  //! Defines the Playmode of an Entity.
[7338]30  typedef enum {
[7346]31    Vertical         = 1,       //!< Vertical (seen from left or right/move in x-z)
32    Horizontal       = 2,       //!< Horizontal (seet from the top/move in x-y)
33    FromBehind       = 4,       //!< Seen from behind (move in z-y)
34    Full3D           = 8,       //!< Full featured 3D-mode. (move in all directions x-y-z)
[7338]35  } Playmode;
[5838]36
37
[7338]38public:
39  virtual ~Playable();
[6966]40
[7338]41  virtual void loadParams(const TiXmlElement* root);
[6547]42
[7346]43  // Weapon and Pickups
[7338]44  virtual bool pickup(PowerUp* powerUp);
[7350]45  bool addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
[7338]46  void removeWeapon(Weapon* weapon);
47  void nextWeaponConfig();
48  void previousWeaponConfig();
49  inline WeaponManager& getWeaponManager() { return this->weaponMan; };
50  void weaponConfigChanged();
[7351]51  static void addSomeWeapons_CHEAT();
[5895]52
[6241]53
[7346]54  // Player Settup
[7338]55  bool setPlayer(Player* player);
56  Player* getCurrentPlayer() const { return this->currentPlayer; };
[7346]57  /** @return a List of Events in PEV_* sytle */
58  inline const std::vector<int>& getEventList() { return this->events; };
[5898]59
[7346]60  // Camera and Playmode
[7338]61  void attachCamera();
62  void detachCamera();
[7347]63  void setCameraMode(unsigned int cameraMode = 0);
[7338]64  bool playmodeSupported(Playable::Playmode playmode) const { return this->supportedPlaymodes & playmode; };
[7339]65  bool setPlaymode(Playable::Playmode playmode);
66  Playable::Playmode getPlaymode() const { return this->playmode; };
[7346]67  virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f) = 0;
68  void setPlayDirection(float angle, float dirX, float dirY, float dirZ, float speed = 0.0f);
[5898]69
[7346]70  inline void setScore( int score ) { this->score = score; }
71  inline int  getScore() { return this->score; }
72
73
74  // WorldEntity Extensions
75  virtual void die();
76  virtual void respawn();
[7338]77  virtual void collidesWith(WorldEntity* entity, const Vector& location);
78  virtual void process(const Event &event);
79  virtual void tick(float dt);
[6966]80
[7339]81  // Transformations:
82  static Playable::Playmode stringToPlaymode(const std::string& playmode);
83  static const char* playmodeToString(Playable::Playmode playmode);
[7338]84protected:
85  Playable();
[5872]86
[7346]87  // Player Setup
[7338]88  virtual void enter() = 0;
89  virtual void leave() = 0;
[7346]90  // Playmode
[7338]91  void setSupportedPlaymodes(short playmodes) { this->supportedPlaymodes = playmodes; };
[7346]92  virtual void enterPlaymode(Playable::Playmode playmode);
[5888]93
[7346]94  // Events.
[7338]95  void registerEvent(int eventType);
96  void unregisterEvent(int eventType);
[6966]97
[7338]98private:
99  WeaponManager         weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
100  std::vector<int>      events;             //!< A list of Events, that are captured for this playable
[6804]101
[7338]102  Player*               currentPlayer;      //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL
[7118]103
[7338]104  bool                  bFire;              //!< If the Ship is firing.
105  int                   oldFlags;           //!< Used for synchronisation
[7072]106
[7444]107  int                   score;              //!< players score
[7118]108
[7338]109  bool                  bDead;
110  short                 supportedPlaymodes; //!< What Playmodes are Supported in this Playable.
111  Playable::Playmode    playmode;           //!< The current playmode.
112
113  WorldEntity* collider;
[5838]114};
115
116#endif /* _PLAYABLE_H */
Note: See TracBrowser for help on using the repository browser.