-
Notifications
You must be signed in to change notification settings - Fork 1
/
ship.h
42 lines (30 loc) · 1.06 KB
/
ship.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include "entity.h"
#include "game.h"
// -------------------------------------------------------------------------------------------------
class Ship : public Entity
{
public:
Ship(void);
virtual ~Ship(void) override;
virtual void Spawn(Game *game) override;
virtual void Update(Game *game) override;
virtual void Destroy(Game *game) override;
// Call this before update.
void ProcessInput(Game *game);
virtual void OnCollideWith(const Game *game, Entity *other) override;
private:
void UpdateControls(const InputHandler *input);
void FireWeapon(Game *game);
public:
static constexpr float RADIUS = 2.0f;
private:
static constexpr float TURN_SPEED = 180; // degrees/sec
static constexpr float ACCELERATION = 40; // units/sec^2
static constexpr float MAX_SPEED = 20; // units/sec
static constexpr float WEAPON_FIRE_RATES[3] = { 6, 5, 3 }; // shots/sec
float m_heading = 0;
float m_nextWeaponFire = 0;
emitter_t *m_trailEmitter = nullptr; // Engine trail particle emitter
WarpEffect *m_warpEffect = nullptr; // Effect used for spawning the ship
};