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