Implement basic interfaces
parent
f8f640ae89
commit
5ad777e03b
@ -1,22 +1,39 @@
|
|||||||
#ifndef HERO_H
|
#ifndef HERO_H
|
||||||
#define HERO_H
|
#define HERO_H
|
||||||
|
|
||||||
|
enum class Direction
|
||||||
|
{
|
||||||
|
LEFT,
|
||||||
|
UP,
|
||||||
|
RIGHT,
|
||||||
|
DOWN,
|
||||||
|
NONE
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Represents a controlable by player game character
|
||||||
class Hero
|
class Hero
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int hero_charges;
|
int hero_charges;
|
||||||
|
int pos_x, pos_y;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Hero(int initial_charges = 0);
|
explicit Hero(int position_x = 0, int position_y = 0, int initial_charges = 0);
|
||||||
|
|
||||||
|
/// Add more charges for hero to use
|
||||||
|
void refillCharges(int append_charges);
|
||||||
|
|
||||||
|
/// Get amount of charges
|
||||||
|
int charges() const noexcept;
|
||||||
|
|
||||||
// Add more charges for hero to use
|
/// Spend one charge on action
|
||||||
inline void refillCharges(int append_charges);
|
bool useCharge();
|
||||||
|
|
||||||
// Get amount of charges
|
/// Get current Hero position
|
||||||
inline int charges() const noexcept;
|
void position(int &x, int &y) const noexcept;
|
||||||
|
|
||||||
// Spend one charge on action
|
/// Move hero by one cell to any direction
|
||||||
inline bool useCharge();
|
void move(Direction &direction);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HERO_H
|
#endif // HERO_H
|
||||||
|
Loading…
Reference in New Issue