Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entities/player.h @ 4833

Last change on this file since 4833 was 4818, checked in by patrick, 19 years ago

orxonox/trunk: crosshair gets deleted also, now all event listeners are removed at the end

File size: 2.1 KB
Line 
1/*!
2    \file player.h
3    \brief Implements a basic controllable WorldEntity
4 */
5
6#ifndef _PLAYER_H
7#define _PLAYER_H
8
9#include "world_entity.h"
10#include "physics_interface.h"
11#include "event_listener.h"
12
13template<class T> class tList;
14class Weapon;
15class WeaponManager;
16class Vector;
17class World;
18class Event;
19class Crosshair;
20
21//! Basic controllable WorldEntity
22class Player : public WorldEntity, public PhysicsInterface, public EventListener
23{
24  friend class World;
25
26  public:
27    Player();
28    Player(const TiXmlElement* root);
29    virtual ~Player();
30
31    void init();
32    void loadParams(const TiXmlElement* root);
33
34    void addWeapon(Weapon* weapon);
35    void removeWeapon(Weapon* weapon);
36
37    virtual void postSpawn();
38    virtual void leftWorld();
39    virtual void hit(WorldEntity* weapon, Vector* loc);
40    virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags);
41
42    virtual void tick(float time);
43    virtual void draw();
44
45    virtual void command(Command* cmd);
46
47    virtual void process(const Event &event);
48
49
50  private:
51    void move(float time);
52    void weapon();
53
54
55  private:
56    bool bUp;              //!< up button pressed.
57    bool bDown;            //!< down button pressed.
58    bool bLeft;            //!< left button pressed.
59    bool bRight;           //!< right button pressed.
60    bool bAscend;          //!< ascend button pressed.
61    bool bDescend;         //!< descend button presses.
62    bool bFire;            //!< fire button pressed.
63    bool bWeaponChange;    //!< weapon change button pressed
64
65    tList<Weapon>* weapons;//!< a list of weapon
66    Weapon* activeWeapon;  //!< the weapon that is currenty activated
67    Weapon* activeWeaponL;  //temporary -- FIX THIS
68    WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
69
70    World* myWorld;        //!< reference to the world object
71
72    Vector* velocity;       //!< the velocity of the player.
73    float travelSpeed;     //!< the current speed of the player (to make soft movement)
74    float acceleration;    //!< the acceleration of the player.
75
76    Crosshair*  crosshair; //!< the crosshair of the player
77
78};
79
80#endif /* _PLAYER_H */
Note: See TracBrowser for help on using the repository browser.