-
Notifications
You must be signed in to change notification settings - Fork 0
/
UnitEvents.h
42 lines (35 loc) · 1008 Bytes
/
UnitEvents.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 "event.h"
#include "unit.h"
class UnitEvent : public Event
{
public:
Unit* getUnit() const { return mpUnit; }
protected:
UnitEvent(EventType type, Unit* const unit) : Event(type), mpUnit(unit) { };
Unit* const mpUnit;
};
class UnitAddEvent : public UnitEvent
{
public:
UnitAddEvent(Unit* unit) : UnitEvent(EventType::UNIT_ADD_EVENT, unit) {};
};
class UnitRemoveEvent : public UnitEvent
{
public:
UnitRemoveEvent(Unit* const unit) : UnitEvent(EventType::UNIT_REMOVE_EVENT, unit) {};
};
class UnitMoveEvent : public UnitEvent
{
public:
UnitMoveEvent(Unit* const unit, const Vector2D destination, const float milliseconds) :
UnitEvent(EventType::UNIT_MOVE_EVENT, unit),
mDestination(destination),
mMilliseconds(milliseconds)
{};
const Vector2D &getDestination() const { return mDestination; }
const float &getMilliseconds() const { return mMilliseconds; }
private:
const Vector2D mDestination;
const float mMilliseconds;
};