Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.h @ 2006

Last change on this file since 2006 was 2006, checked in by landauf, 16 years ago

many changes, can't remember everything, but these are the most important:

  • attaching entities to other entities works
  • displaying models, lights and shadows works
  • controlling a spectator works
  • removed an update hack in PositionableEntity because I've found a much better solution

and with "works" I mean: it works on client, server and standalone

File size: 3.4 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _PlayerInfo_H__
30#define _PlayerInfo_H__
31
32#include "OrxonoxPrereqs.h"
33
34#include "Info.h"
35#include "core/Identifier.h"
36#include "objects/controllers/Controller.h"
37
38namespace orxonox
39{
40    class _OrxonoxExport PlayerInfo : public Info
41    {
42        public:
43            PlayerInfo();
44            virtual ~PlayerInfo();
45
46            void setConfigValues();
47            void registerVariables();
48
49            virtual void changedName();
50
51            inline void setClientID(unsigned int clientID)
52                { this->clientID_ = clientID; this->checkClientID(); }
53            inline unsigned int getClientID() const
54                { return this->clientID_; }
55
56            inline bool isHumanPlayer() const
57                { return this->bHumanPlayer_; }
58
59            inline bool isLocalPlayer() const
60                { return this->bLocalPlayer_; }
61
62            virtual void startControl(ControllableEntity* pawn);
63            virtual void stopControl();
64
65            inline ControllableEntity* getPawn() const
66                { return this->pawn_; }
67/*
68            inline void setController(Controller* controller)
69                { this->controller_ = controller; }
70            inline Controller* getController() const
71                { return this->controller_; }
72*/
73            inline void setGametype(Gametype* gametype)
74                { this->gametype_ = gametype; }
75            inline Gametype* getGametype() const
76                { return this->gametype_; }
77
78        protected:
79            inline void setDefaultController(Identifier* identifier)
80                { this->defaultController_ = identifier; }
81
82        private:
83            virtual void createController();
84            virtual void takeLocalControl();
85
86            void checkClientID();
87            void finishedSetup();
88            void checkNick();
89            void clientChangedName();
90            void updatePawn();
91
92            unsigned int clientID_;
93            float ping_;
94            bool bLocalPlayer_;
95            bool bHumanPlayer_;
96            bool bFinishedSetup_;
97
98            std::string playerName_;
99            std::string nick_;
100
101            ControllableEntity* pawn_;
102            unsigned int pawnID_;
103            Controller* controller_;
104            SubclassIdentifier<Controller> defaultController_;
105            Gametype* gametype_;
106    };
107}
108
109#endif /* _PlayerInfo_H__ */
Note: See TracBrowser for help on using the repository browser.