2010-04-05 23:38:59 +02:00
|
|
|
#ifndef _SHIPENTITY_H
|
|
|
|
#define _SHIPENTITY_H
|
|
|
|
|
|
|
|
#include "EntityBase.h"
|
|
|
|
#include "AsteroidsEnums.h"
|
|
|
|
#include "Sprite.h"
|
|
|
|
|
|
|
|
namespace asteroids {
|
|
|
|
|
|
|
|
struct ShipEntityPhysicState : public Engine::EntityPhysicState {
|
|
|
|
ShipEntityPhysicState () {
|
|
|
|
mType = GameEntityTypeShip;
|
|
|
|
mBaseType = Engine::EntityBaseTypeActor;
|
2010-11-27 20:56:38 +01:00
|
|
|
|
2010-04-05 23:38:59 +02:00
|
|
|
mAcceleration = 10.;
|
|
|
|
mMaxSpeed = 10.;
|
|
|
|
mRotationSpeed = 180.;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~ShipEntityPhysicState() {};
|
|
|
|
|
|
|
|
float mAcceleration;
|
|
|
|
float mMaxSpeed;
|
|
|
|
float mRotationSpeed;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ShipEntity: public Engine::EntityBase {
|
|
|
|
enum State {
|
|
|
|
Idle = 0,
|
|
|
|
Accelerating,
|
|
|
|
Rotating,
|
|
|
|
Shooting,
|
|
|
|
Dying
|
|
|
|
};
|
|
|
|
|
|
|
|
ShipEntity () {
|
|
|
|
mType = GameEntityTypeShip;
|
|
|
|
mBaseType = Engine::EntityBaseTypeActor;
|
|
|
|
|
2010-11-27 20:56:38 +01:00
|
|
|
mAlive = true;
|
2010-04-05 23:38:59 +02:00
|
|
|
mState = Idle;
|
2010-04-08 19:03:16 +02:00
|
|
|
mAttackTimer = 0.;
|
2010-04-05 23:38:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~ShipEntity() {};
|
|
|
|
|
|
|
|
virtual void Attack ();
|
|
|
|
virtual void Update (float delta_sec);
|
2010-12-01 10:18:45 +01:00
|
|
|
virtual bool CollisionEvent (Engine::EntityBase *entity, vector3d point, vector3d normal);
|
2010-04-05 23:38:59 +02:00
|
|
|
|
|
|
|
bool mAlive;
|
|
|
|
float mFadeTimer;
|
2010-04-08 19:03:16 +02:00
|
|
|
float mAttackTimer;
|
2010-04-05 23:38:59 +02:00
|
|
|
State mState;
|
2010-04-08 19:03:16 +02:00
|
|
|
|
|
|
|
static Engine::Variable VarAcceleration;
|
|
|
|
static Engine::Variable VarMaxSpeed;
|
|
|
|
static Engine::Variable VarRotationSpeed;
|
|
|
|
static Engine::Variable VarMaxAttackRate;
|
2010-04-05 23:38:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _SHIPENTITY_H
|