Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/objects/worldentities/MovableEntity.h @ 3864

Last change on this file since 3864 was 3196, checked in by rgrieder, 16 years ago

Merged pch branch back to trunk.

  • Property svn:eol-style set to native
File size: 3.6 KB
RevLine 
[2072]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
[2662]24 *      Reto Grieder
[2072]25 *   Co-authors:
26 *      ...
27 *
28 */
29
30#ifndef _MovableEntity_H__
31#define _MovableEntity_H__
32
33#include "OrxonoxPrereqs.h"
34
[3196]35#include "util/Math.h"
[2072]36#include "network/ClientConnectionListener.h"
[2662]37#include "tools/Timer.h"
[3196]38#include "MobileEntity.h"
[2072]39
40namespace orxonox
41{
[2662]42    class _OrxonoxExport MovableEntity : public MobileEntity, public ClientConnectionListener
[2072]43    {
44        public:
45            MovableEntity(BaseObject* creator);
46            virtual ~MovableEntity();
47
48            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
[3033]49            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
[2072]50            void registerVariables();
51
52            using WorldEntity::setPosition;
53            using WorldEntity::setOrientation;
54
[2662]55            inline void setPosition(const Vector3& position)
56                { MobileEntity::setPosition(position); this->overwrite_position_ = this->getPosition(); }
57            inline void setOrientation(const Quaternion& orientation)
58                { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); }
[2072]59
[3033]60            inline void setOwner(Pawn* owner)
61                { this->owner_ = owner; }
62            inline Pawn* getOwner() const
63                { return this->owner_; }
64
65            inline void setCollisionDamage(float c)
66                { this->collisionDamage_ = c; }
67
68            inline float getCollisionDamage()
69                { return this->collisionDamage_; }
70
71            inline void setEnableCollisionDamage(bool c)
72            { 
73                this->enableCollisionDamage_ = c; 
74                this->enableCollisionCallback();
75            } 
76
77            inline bool getEnableCollisionDamage()
78                { return this->enableCollisionDamage_; }
79
[2072]80        private:
81            void clientConnected(unsigned int clientID);
82            void clientDisconnected(unsigned int clientID);
83            void resynchronize();
84
[2662]85            inline void processLinearVelocity()
86                { this->setVelocity(this->linearVelocity_); }
87            inline void processAngularVelocity()
88                { this->setAngularVelocity(this->angularVelocity_); }
[2072]89
[2662]90            inline void overwritePosition()
91                { this->setPosition(this->overwrite_position_); }
92            inline void overwriteOrientation()
93                { this->setOrientation(this->overwrite_orientation_); }
[2072]94
[2662]95            Vector3    overwrite_position_;
[2072]96            Quaternion overwrite_orientation_;
[2662]97
98            Timer<MovableEntity> resynchronizeTimer_;
99            Timer<MovableEntity>* continuousResynchroTimer_;
[3033]100
101            Pawn* owner_;
102            float collisionDamage_;
103            bool enableCollisionDamage_;
[2072]104    };
105}
106
107#endif /* _MovableEntity_H__ */
Note: See TracBrowser for help on using the repository browser.