29 #ifndef _SpaceShip_H__ 30 #define _SpaceShip_H__ 35 #include <LinearMath/btVector3.h> 97 virtual void tick(
float dt);
98 void setConfigValues();
105 { this->steering_.z -= (0.6)*value.x; }
111 { this->steering_.x += (0.6)*value.x; }
117 { this->steering_.y += (0.6)*value.x; }
120 { this->moveFrontBack(Vector2(value, 0)); }
122 { this->moveRightLeft(Vector2(value, 0)); }
124 { this->moveUpDown(Vector2(value, 0)); }
126 virtual void rotateYaw(
const Vector2& value);
127 virtual void rotatePitch(
const Vector2& value);
128 virtual void rotateRoll(
const Vector2& value);
131 virtual void boost(
bool bBoost);
133 void addEngine(
Engine* engine);
134 bool hasEngine(
Engine* engine)
const;
135 Engine* getEngine(
unsigned int i);
142 {
return this->engineList_; }
143 void removeEngine(
Engine* engine);
144 void removeAllEngines();
146 void addSpeedFactor(
float factor);
147 void addSpeed(
float speed);
148 float getSpeedFactor()
const;
150 float getMaxSpeedFront()
const;
151 float getBoostFactor()
const;
159 { this->steering_ = direction; }
165 {
return this->steering_; }
172 {
return this->bBoost_; }
178 {
return bBoostCooldown_; }
186 {
OrxAssert(power >= 0.0f,
"The boost power must be non-negative."); this->initialBoostPower_ = power; this->boostPower_ = power; }
192 {
OrxAssert(rate >= 0.0f,
"The boost power rate must be non-negative."); this->boostPowerRate_ = rate; }
198 {
OrxAssert(rate >= 0.0f,
"The boost rate must be non-negative."); this->boostRate_ = rate; }
205 {
OrxAssert(duration >= 0.0f,
"The boost cooldown duration must be non-negative."); this->boostCooldownDuration_ = duration; }
211 {
OrxAssert(frequency >= 0.0f,
"The shake frequency must be non-negative."); this->shakeFrequency_ = frequency; }
217 {
OrxAssert(amplitude >= 0.0f,
"The shake amplitude must be non-negative."); this->shakeAmplitude_ = amplitude; }
224 {
return this->initialBoostPower_; }
230 {
return this->boostPower_; }
236 {
return this->boostPowerRate_; }
242 {
return this->boostRate_; }
248 {
return this->boostCooldownDuration_; }
254 {
return this->shakeFrequency_; }
260 {
return this->shakeAmplitude_; }
265 void gainBoostPower(
float gainedBoostPower);
289 void registerVariables();
292 void changedEnableMotionBlur();
297 { this->bBoostCooldown_ =
false; }
299 void shakeCamera(
float dt);
const std::vector< Engine * > & getEngineList() const
Get the list of all Engines that are mounted on the SpaceShip.
Definition: SpaceShip.h:141
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
bool isBoostCoolingDown() const
Check whether the SpaceShip boost is cooling down.
Definition: SpaceShip.h:177
void moveRightLeft(float value)
Definition: SpaceShip.h:121
float initialBoostPower_
The initial (and maximal) boost power.
Definition: SpaceShip.h:277
bool bInvertYAxis_
Definition: SpaceShip.h:268
Definition: CorePrereqs.h:309
Vector3 steering_
The direction and magnitude of the steering action given through user input.
Definition: SpaceShip.h:270
bool bBoostCooldown_
Whether the SpaceShip is currently in boost cooldown, during which boosting is impossible.
Definition: SpaceShip.h:276
bool bBoost_
Whether the SpaceShip is currently boosting.
Definition: SpaceShip.h:275
void setBoostPowerRate(float rate)
Set the rate, at which boost power is recharged, to the input value.
Definition: SpaceShip.h:191
bool isBoosting() const
Check whether the SpaceShip is currently boosting.
Definition: SpaceShip.h:171
float boostPower_
The current boost power. If the boost power is reduced to zero the boost cooldown will start...
Definition: SpaceShip.h:278
float boostPowerRate_
The rate at which the boost power is recharged.
Definition: SpaceShip.h:279
float getBoostPowerRate() const
Get the boost power rate.
Definition: SpaceShip.h:235
virtual void moveRightLeft(const Vector2 &value)
Move right or left.
Definition: SpaceShip.h:110
void setShakeFrequency(float frequency)
Set the frequency with which the camera shakes during boosting.
Definition: SpaceShip.h:210
float rotationThrust_
Force with which the SpaceShip rotates.
Definition: SpaceShip.h:272
::std::string string
Definition: gtest-port.h:756
void moveFrontBack(float value)
Definition: SpaceShip.h:119
float shakeAmplitude_
The amplitude of the shaking of the camera due to boosting.
Definition: SpaceShip.h:283
float blurStrength_
The strength of the applied blur.
Definition: SpaceShip.h:311
#define OrxAssert(condition, errorMessage)
Run time assertion like assert(), but with an embedded message.
Definition: OrxAssert.h:54
Shader is a wrapper class around Ogre::CompositorInstance.
Definition: Shader.h:47
float getBoostPower() const
Get the current boost power.
Definition: SpaceShip.h:229
xmlelement
Definition: Super.h:519
The SpaceShip is the principal entity through which the player interacts with the game...
Definition: SpaceShip.h:90
Declaration and implementation of several math-functions, typedefs of some Ogre::Math classes to the ...
Declaration of the Timer class, used to call functions after a given time-interval.
float getInitialBoostPower() const
Get the initial boost power.
Definition: SpaceShip.h:223
float lift_
The amount of lift that is added.
Definition: SpaceShip.h:285
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
float getBoostRate() const
Get the boost rate.
Definition: SpaceShip.h:241
float stallSpeed_
The forward speed where no more lift is added.
Definition: SpaceShip.h:286
Mode
Definition: CorePrereqs.h:102
CollisionType
Denotes the possible types of physical objects in a Scene.
Definition: WorldEntity.h:265
Shared library macros, enums, constants and forward declarations for the orxonox library ...
Shader * boostBlur_
A radial blur shader, applied when boosting according to the amount of boosting.
Definition: SpaceShip.h:310
Quaternion cameraOriginalOrientation_
The original orientation of the camera before shaking it.
Definition: SpaceShip.h:308
float getShakeFrequency() const
Get the shake frequency.
Definition: SpaceShip.h:253
const Vector3 & getSteeringDirection() const
Get the steering direction of the SpaceShip.
Definition: SpaceShip.h:164
float shakeDt_
Temporary variable for the shaking of the camera.
Definition: SpaceShip.h:306
Timer timer_
Timer for the cooldown of the boost.
Definition: SpaceShip.h:305
float getBoostCooldownDuration() const
Get the cooldown duration.
Definition: SpaceShip.h:247
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
void setInitialBoostPower(float power)
Set the initial power available for boosting to the input value.
Definition: SpaceShip.h:185
void setBoostCooldownDuration(float duration)
Set the duration for which boosting, if in cooldown, is not possible.
Definition: SpaceShip.h:204
virtual void moveFrontBack(const Vector2 &value)
Move forward or backward,.
Definition: SpaceShip.h:104
void setShakeAmplitude(float amplitude)
Set the amplitude with which the camera shakes during boosting.
Definition: SpaceShip.h:216
void boostCooledDown(void)
Callback function.
Definition: SpaceShip.h:296
Vector3 cameraOriginalPosition_
The original position of the camera before shaking it.
Definition: SpaceShip.h:307
void moveUpDown(float value)
Definition: SpaceShip.h:123
virtual void moveUpDown(const Vector2 &value)
Move up or down.
Definition: SpaceShip.h:116
The Engine class provides propulsion to the SpaceShip.
Definition: Engine.h:55
std::vector< Engine * > engineList_
The list of all Engines mounted on this SpaceShip.
Definition: SpaceShip.h:303
Timer is a helper class that executes a function after a given amount of seconds in game-time...
Definition: Timer.h:105
float boostCooldownDuration_
The duration for which boost cooldown is in effect.
Definition: SpaceShip.h:281
void setBoostRate(float rate)
Set the rate, at which boost power us used up, to the input value.
Definition: SpaceShip.h:197
float boostRate_
The rate at which boost power is used up.
Definition: SpaceShip.h:280
btVector3 localAngularAcceleration_
The acceleration that accounts for angular movement and is used internally.
Definition: SpaceShip.h:273
float shakeFrequency_
The frequency of the shaking of the camera due to boosting.
Definition: SpaceShip.h:282
Declaration of custom assertion facilities
void setSteeringDirection(const Vector3 &direction)
Set the steering direction of the SpaceShip.
Definition: SpaceShip.h:158
bool bEnableMotionBlur_
Whether motion blur is enabled or not.
Definition: SpaceShip.h:312
float getShakeAmplitude() const
Get the shake amplitude.
Definition: SpaceShip.h:259