66 lines
1.2 KiB
C++
66 lines
1.2 KiB
C++
#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;
|
|
|
|
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;
|
|
|
|
mAlive = true;
|
|
mFadeTimer = 0.;
|
|
mState = Idle;
|
|
mAttackTimer = 0.;
|
|
}
|
|
|
|
virtual ~ShipEntity() {};
|
|
|
|
virtual void Attack ();
|
|
virtual void Update (float delta_sec);
|
|
virtual bool CollisionEvent (Engine::EntityBase *entity);
|
|
|
|
bool mAlive;
|
|
float mFadeTimer;
|
|
float mAttackTimer;
|
|
State mState;
|
|
|
|
static Engine::Variable VarAcceleration;
|
|
static Engine::Variable VarMaxSpeed;
|
|
static Engine::Variable VarRotationSpeed;
|
|
static Engine::Variable VarMaxAttackRate;
|
|
};
|
|
|
|
}
|
|
|
|
#endif // _SHIPENTITY_H
|