-
Notifications
You must be signed in to change notification settings - Fork 0
/
CUnit.h
64 lines (47 loc) · 1.79 KB
/
CUnit.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef SEMESTRAL_WORK_CUNIT_H
#define SEMESTRAL_WORK_CUNIT_H
#include <ncurses.h>
//----------------------------------------------------------------------------------------------------------------------
enum PowerUpType{DoubleDamage, Immunity, Ammo, Life};
enum EnemyType{Weak, Strong};
struct DirectionType{
int Up;
int Down;
int Left;
int Right;
};
//----------------------------------------------------------------------------------------------------------------------
class CUnit{
public:
CUnit();
explicit CUnit(DirectionType direction);
~CUnit() = default;
virtual void Print(int y_Pos, int x_Pos) const = 0;
virtual bool Move(int & x_Shift, int & y_Shift) const = 0;
void ChangeDirection();
void SetDirection(const DirectionType & direction);
void SetPrinted(bool value);
bool GetPrinted();
protected:
bool Printed;
DirectionType Direction;
};
//----------------------------------------------------------------------------------------------------------------------
class CWall : public CUnit{
public:
CWall() = default;
~CWall() = default;
void Print(int y_Pos, int x_Pos) const override;
bool Move(int & x_Shift, int & y_Shift) const override;
};
//----------------------------------------------------------------------------------------------------------------------
class CBullet : public CUnit{
public:
CBullet() = default;
explicit CBullet(DirectionType direction);
~CBullet() = default;
void Print(int y_Pos, int x_Pos) const override;
bool Move(int & x_Shift, int & y_Shift) const override;
};
//----------------------------------------------------------------------------------------------------------------------
#endif //SEMESTRAL_WORK_CUNIT_H