-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFood.h
47 lines (35 loc) · 1.13 KB
/
Food.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
#ifndef FOOD_H
#define FOOD_H
#include "Actor_Base.h"
#include "Collider.h"
class Food : public Actor_Base {
static unsigned s_numFood;
float m_energy; // Energy granted to the eater
float m_age;
float m_duration;
bool m_hasUnlimitedDuration;
bool m_wasEaten; // Used to discern the energy responsibility. If it was eaten nothing happens, else it returns the energy on destruction.
public:
Food(SharedContext& t_context,
const sf::Vector2f& t_position,
const float& t_rotation,
const float& t_energy,
const float& t_duration,
bool t_isSpriteVisible = true,
bool t_isTextVisible = true);
const float& getEnergy()const;
void setEnergy(const float& t_energy);
const float& getAge()const;
void setAge(const float& t_age);
const float& getDuration()const;
void setDuration(const float& t_duration);
void setWasEaten(bool t_wasEaten);
static unsigned getNumFood();
bool canSpawn(SharedContext& t_context)const;
void onSpawn(SharedContext& t_context);
void onDestruction(SharedContext& t_context);
void update(const float& t_elapsed);
void updateCollider();
ActorPtr clone(SharedContext& t_context);
};
#endif // !FOOD_H