-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayScene.hpp
93 lines (90 loc) · 2.29 KB
/
PlayScene.hpp
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef PLAYSCENE_HPP
#define PLAYSCENE_HPP
#include <allegro5/allegro_audio.h>
#include <list>
#include <memory>
#include <utility>
#include <vector>
#include <tuple>
#include "IScene.hpp"
#include "Point.hpp"
class Turret;
namespace Engine {
class Group;
class Image;
class Label;
class Sprite;
} // namespace Engine
class PlayScene final : public Engine::IScene {
private:
ALLEGRO_SAMPLE_ID bgmId;
std::shared_ptr<ALLEGRO_SAMPLE_INSTANCE> deathBGMInstance;
protected:
int lives;
int money;
int SpeedMult;
public:
enum TileType {
TILE_DIRT,
TILE_FLOOR,
TILE_OCCUPIED,
};
static bool DebugMode;
static const std::vector<Engine::Point> directions;
static const int MapWidth, MapHeight;
static const int BlockSize;
static const int SpawnGridPointx;
static const int EndGridPointx;
static const int SpawnGridPointy;
static const int EndGridPointy;
static const float DangerTime;
static const std::vector<int> code;
int MapId;
float ticks;
float deathCountDown;
// Map tiles.
Group* TileMapGroup;
Group* GroundEffectGroup;
Group* DebugIndicatorGroup;
Group* BulletGroup;
Group* TowerGroup;
Group* EnemyGroup;
Group* EnemyBulletGroup;
Group* EffectGroup;
Group* MoneyGroup;
Group* UIGroup;
Engine::Label* UIMoney;
Engine::Label* UILives;
Engine::Image* imgTarget;
Engine::Sprite* dangerIndicator;
Turret* preview;
std::vector<std::vector<TileType>> mapState;
std::vector<int> laneNum;
std::vector<int> columnNum;
std::list<std::tuple<int, float,int>> enemyWaveData;
std::list<std::tuple<int, float,int>> moneyWaveData;
std::list<int> keyStrokes;
static Engine::Point GetClientSize();
explicit PlayScene() = default;
void AddLives(int lives);
void Initialize() override;
void Terminate() override;
void Update(float deltaTime) override;
void Draw() const override;
void OnMouseDown(int button, int mx, int my) override;
void OnMouseMove(int mx, int my) override;
void OnMouseUp(int button, int mx, int my) override;
void OnKeyDown(int keyCode) override;
void Hit();
int GetMoney() const;
void EarnMoney(int money);
void ReadMap();
void ReadEnemyWave();
void ReadMoneyWave();
void ConstructUI();
void UIBtnClicked(int id);
bool CheckSpaceValid(int x, int y);
std::vector<std::vector<int>> CalculateBFSDistance();
// void ModifyReadMapTiles();
};
#endif // PLAYSCENE_HPP