-
Notifications
You must be signed in to change notification settings - Fork 0
/
Level.hpp
56 lines (50 loc) · 1.23 KB
/
Level.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
#ifndef LD36_LEVEL_HPP
#define LD36_LEVEL_HPP
#include <Engine/Scene.hpp>
#include <SFML/Audio/Sound.hpp>
class Level: public engine::Scene {
public:
struct Pyramid {
struct Part {
sf::IntRect area;
sf::Vector2f goal;
sf::Vector2f attach[2];
std::vector<sf::FloatRect> shapes;
};
std::string texture;
sf::IntRect previewArea;
sf::Vector2f size;
float scale;
std::vector<Part> parts;
std::string backgroundTexture;
};
protected:
std::vector<Pyramid> m_pyramids;
size_t m_pyramid;
std::vector<std::pair<bool, engine::Node*>> m_parts;
size_t m_currentPart;
float m_destroyParticleTime;
bool m_levelDone;
bool m_levelRated;
float m_settleTimer;
engine::util::EventHandler<const sf::Event::KeyEvent&>* m_keyHandler;
float m_score;
sf::Sound* m_soundSummon;
sf::Sound* m_scoringSound;
float m_hintScale;
float m_partFlash;
bool m_partFlashColor;
public:
Level(engine::Game* game);
~Level();
bool SetPyramid(size_t pyramid);
virtual bool initialize(Json::Value& root);
void MakePart(engine::Node* ufo);
void RemovePartRope();
void DestroyParticles(engine::Node* node);
static std::string GetRating(float score);
protected:
virtual void OnUpdate(sf::Time interval);
void Rate();
};
#endif //LD36_LEVEL_HPP