-
Notifications
You must be signed in to change notification settings - Fork 0
/
Actor.h
60 lines (48 loc) · 1.21 KB
/
Actor.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include <vector>
#include "Math.h"
class Actor
{
public:
enum State
{
EActive,
EPaused,
EDead
};
enum Name
{
ETower,
EEnery,
EActor
};
Actor(class Game* game);
virtual ~Actor();
// Update function called from Game (not overridable)
void Update(float deltaTime);
// Updates all the components attached to the actor (not overridable)
void UpdateComponents(float deltaTime);
// Any actor-specific update code (overridable)
virtual void UpdateActor(float deltaTime);
// Getters/setters
const Vector2& GetPosition() const { return mPosition; }
void SetPosition(const Vector2& pos) { mPosition = pos; }
void AddPosition(const Vector2& pos){mPosition+=pos;}
float GetScale() const { return mScale; }
void SetScale(float scale) { mScale = scale; }
State GetState() const { return mState; }
void SetState(State state) { mState = state; }
class Game* GetGame(){ return mGame; }
// Add/remove components
void AddComponent(class Component* component);
void RemoveComponent(class Component* component);
Name mName=EActor;
private:
// Actor's state
State mState;
// Transform
Vector2 mPosition;
float mScale;
std::vector<class Component*> mComponents;
class Game* mGame;
};