Orxonox  0.0.5 Codename: Arcturus
MovableEntity.h
Go to the documentation of this file.
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  * Reto Grieder
25  * Co-authors:
26  * ...
27  *
28  */
29 
30 #ifndef _MovableEntity_H__
31 #define _MovableEntity_H__
32 
33 #include "OrxonoxPrereqs.h"
34 
35 #include "util/Math.h"
37 #include "tools/Timer.h"
38 #include "MobileEntity.h"
39 
40 namespace orxonox
41 {
43  {
44  public:
45  MovableEntity(Context* context);
46  virtual ~MovableEntity();
47 
48  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
49  virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override;
50 
53 
54  virtual inline void setPosition(const Vector3& position) override
55  { MobileEntity::setPosition(position); this->overwrite_position_ = this->getPosition(); }
56  virtual inline void setOrientation(const Quaternion& orientation) override
57  { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); }
58 
59  inline void setOwner(Pawn* owner)
60  { this->owner_ = owner; }
61  inline Pawn* getOwner() const
62  { return this->owner_; }
63 
64  inline void setCollisionDamage(float c)
65  { this->collisionDamage_ = c; }
66 
67  inline float getCollisionDamage()
68  { return this->collisionDamage_; }
69 
70  inline void setEnableCollisionDamage(bool c)
71  {
72  this->enableCollisionDamage_ = c;
73  this->enableCollisionCallback();
74  }
75 
77  { return this->enableCollisionDamage_; }
78 
79  private:
80  void registerVariables();
81  virtual void clientConnected(unsigned int clientID) override;
82  virtual void clientDisconnected(unsigned int clientID) override;
83  void resynchronize();
84 
85  inline void processLinearVelocity()
86  { this->setVelocity(this->linearVelocity_); }
87  inline void processAngularVelocity()
88  { this->setAngularVelocity(this->angularVelocity_); }
89 
90  inline void overwritePosition()
91  { this->setPosition(this->overwrite_position_); }
92  inline void overwriteOrientation()
93  { this->setOrientation(this->overwrite_orientation_); }
94 
97 
100 
104  };
105 }
106 
107 #endif /* _MovableEntity_H__ */
float collisionDamage_
Definition: MovableEntity.h:102
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
virtual void setOrientation(const Quaternion &orientation)=0
virtual void setOrientation(const Quaternion &orientation) override
Definition: MovableEntity.h:56
Pawn * owner_
Definition: MovableEntity.h:101
void overwriteOrientation()
Definition: MovableEntity.h:92
bool getEnableCollisionDamage()
Definition: MovableEntity.h:76
Definition: MovableEntity.h:42
Quaternion overwrite_orientation_
Definition: MovableEntity.h:96
void setCollisionDamage(float c)
Definition: MovableEntity.h:64
bool enableCollisionDamage_
Definition: MovableEntity.h:103
The WorldEntity represents everything that can be put in a Scene at a certain location.
Definition: WorldEntity.h:72
An abstract base class.
Definition: ClientConnectionListener.h:40
xmlelement
Definition: Super.h:519
Declaration and implementation of several math-functions, typedefs of some Ogre::Math classes to the ...
void overwritePosition()
Definition: MovableEntity.h:90
The MobileEntity is a derived class from orxonox::WorldEntity and orxonox::Tickable.
Definition: MobileEntity.h:53
Declaration of the Timer class, used to call functions after a given time-interval.
Pawn * getOwner() const
Definition: MovableEntity.h:61
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Mode
Definition: CorePrereqs.h:102
Shared library macros, enums, constants and forward declarations for the orxonox library ...
virtual void setOrientation(const Quaternion &orientation) override
Definition: MobileEntity.cc:122
Vector3 overwrite_position_
Definition: MovableEntity.h:95
Timer resynchronizeTimer_
Definition: MovableEntity.h:98
Definition: Context.h:45
void processLinearVelocity()
Definition: MovableEntity.h:85
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
virtual void setPosition(const Vector3 &position) override
Definition: MobileEntity.cc:110
void setEnableCollisionDamage(bool c)
Definition: MovableEntity.h:70
float getCollisionDamage()
Definition: MovableEntity.h:67
void setOwner(Pawn *owner)
Definition: MovableEntity.h:59
void processAngularVelocity()
Definition: MovableEntity.h:87
virtual void setPosition(const Vector3 &position) override
Definition: MovableEntity.h:54
Timer is a helper class that executes a function after a given amount of seconds in game-time...
Definition: Timer.h:105
virtual void setPosition(const Vector3 &position)=0
Timer * continuousResynchroTimer_
Definition: MovableEntity.h:99