-
Notifications
You must be signed in to change notification settings - Fork 1
/
item.hpp
110 lines (94 loc) · 2.1 KB
/
item.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#pragma once
#include "actor.hpp"
#include "lightsys.hpp"
namespace Game{
class Pawn;
// item that will be taken on collision
class Item : public Actor
{
public:
Item(const sf::Vector2f& _pos, sf::Texture& _texture, int _activeTime);
void collision(Actor& _oth) override;
virtual void use() { m_cd = m_activeTime; }
virtual void endUse() {}
void process() override;
protected:
//sets the active timer to the given value
// use this if you want to have an item with more timed states
void SetTimer(int _cd) { m_cd = _cd; }
int m_activeTime;
Pawn* m_pawn;
Graphic::LightInfoHandle m_lightInfo;
private:
int m_cd; // countdown or active time
sf::Sound m_soundAppear;
};
// can be placed
// explodes on collision
class Mine : public Item
{
public:
Mine(const sf::Vector2f& _pos);
void collision(Actor& _oth) override;
void use() override;
void endUse() override;
private:
enum struct State {
Pickable, Ticking, Active
};
State m_state;
};
class Sentinel : public Item
{
public:
Sentinel(const sf::Vector2f& _pos);
void collision(Actor& _oth) override;
void use() override;
void endUse() override;
private:
enum struct State {
Pickable, Ticking, Active
};
State m_state;
};
// lets the player shoot multiple projectiles at once
class ClusterGun : public Item
{
public:
ClusterGun(const sf::Vector2f& _pos);
void use() override;
void endUse() override;
};
// increases the light radius temporary
class LightAura : public Item
{
public:
LightAura(const sf::Vector2f& _pos);
void use() override;
void endUse() override;
private:
};
// instantly heal up to full health
class HealthBoost : public Item
{
public:
HealthBoost(const sf::Vector2f& _pos);
void use() override;
void endUse() override;
};
class SpeedBoost : public Item
{
public:
SpeedBoost(const sf::Vector2f& _pos);
void use() override;
void endUse() override;
};
// puts on a child that reflects projectiles toward their origin
class Shield : public Item
{
public:
Shield(const sf::Vector2f& _pos);
void use() override;
void endUse() override;
};
}