62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
#ifndef UNIT_H__
|
|
#define UNIT_H__
|
|
|
|
/* *******************************************************************
|
|
* Includes
|
|
* ******************************************************************/
|
|
|
|
#include "BaseUnit.h"
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
/* *******************************************************************
|
|
* Defines
|
|
* ******************************************************************/
|
|
|
|
/* *******************************************************************
|
|
* Global types definition
|
|
* ******************************************************************/
|
|
|
|
/* *******************************************************************
|
|
* Global variables declaration
|
|
* ******************************************************************/
|
|
|
|
/* *******************************************************************
|
|
* Global functions declaration
|
|
* ******************************************************************/
|
|
|
|
/* *******************************************************************
|
|
* Class definition
|
|
* ******************************************************************/
|
|
|
|
class Unit : public BaseUnit
|
|
{
|
|
public:
|
|
enum tUnitID
|
|
{
|
|
UNIT_ID_NONE,
|
|
UNIT_ID_PEASANT,
|
|
UNIT_ID_SWORDMAN,
|
|
|
|
MAX_UNIT_ID
|
|
};
|
|
|
|
explicit Unit(const Unit::tUnitID eUnitID = UNIT_ID_NONE);
|
|
void create(const enum Unit::tUnitID eUnitID, const uint16_t x, const uint16_t y);
|
|
void handler(void);
|
|
void drawHandler(void);
|
|
void moveTo(const uint16_t x, const uint16_t y);
|
|
|
|
private:
|
|
enum tUnitID _eUnitID;
|
|
enum tUnitState
|
|
{
|
|
UNIT_STATE_IDLE,
|
|
UNIT_STATE_MOVING
|
|
} _eState;
|
|
uint16_t _target_x;
|
|
uint16_t _target_y;
|
|
};
|
|
|
|
#endif /* UNIT_H__ */
|