-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCUnit.cpp
62 lines (46 loc) · 1.65 KB
/
CUnit.cpp
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
#include <iostream>
#include "CUnit.h"
using namespace std;
//----------------------------------------------------------------------------------------------------------------------
CUnit::CUnit()
: Printed(false), Direction({0,0,0,0}){}
CUnit::CUnit(DirectionType direction)
: Printed(false), Direction(direction){}
void CUnit::ChangeDirection(){
int tmp = Direction.Up;
Direction.Up = Direction.Down;
Direction.Down = tmp;
tmp = Direction.Left;
Direction.Left = Direction.Right;
Direction.Right = tmp;
}
void CUnit::SetDirection(const DirectionType & direction){
Direction = direction;
}
void CUnit::SetPrinted(bool value){
Printed = value;
}
bool CUnit::GetPrinted(){
return Printed;
}
//----------------------------------------------------------------------------------------------------------------------
void CWall::Print(int x_Pos, int y_Pos) const{
attron(COLOR_PAIR(7));
mvaddch(x_Pos, y_Pos, ACS_CKBOARD);
attroff(COLOR_PAIR(7));
}
bool CWall::Move(int & x_Shift, int & y_Shift) const{
return false;
}
//----------------------------------------------------------------------------------------------------------------------
CBullet::CBullet(DirectionType direction)
: CUnit(direction){}
void CBullet::Print(int x_Pos, int y_Pos) const{
attron(COLOR_PAIR(4));
mvaddch(x_Pos, y_Pos, ACS_BULLET);
attroff(COLOR_PAIR(4));
}
bool CBullet::Move(int & x_Shift, int & y_Shift) const{
return false;//todo
}
//----------------------------------------------------------------------------------------------------------------------