-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.cs
156 lines (134 loc) · 3.32 KB
/
Player.cs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
using System;
using System.Globalization;
namespace FlyMeToTheMoon
{
public class Player : DrawObject
{
protected int HighScore;
protected int SmHighScore;
protected int Health;
protected int UsedBullets;
protected int Hits;
public bool IsMovingLeft;
public bool IsMovingRight;
protected int Difficulty;
protected int Resolution;
public int GetDifficulty()
{
return Difficulty;
}
public void SetDifficulty(int value)
{
Difficulty = value;
}
public void IncHealth(int value)
{
Health += value;
}
public void IncDifficulty()
{
if (Difficulty == 2)
{
Difficulty = 0;
}
else
{
Difficulty++;
}
}
public int GetResolution()
{
return Resolution;
}
public void SetResolution(int value)
{
Resolution = value;
}
public void IncResolution()
{
if (Resolution == 5)
{
Resolution = 0;
}
else
{
Resolution++;
}
}
public string GetAccuracy()
{
if (UsedBullets == 0) return "0";
float hits = Hits * 100;
var accuracy = hits / UsedBullets;
var decimalValue = Math.Round((decimal)accuracy, 0);
return decimalValue.ToString(CultureInfo.InvariantCulture);
}
public void SetUsedBullets(int value)
{
UsedBullets = value;
}
public void IncUsedBullets(int value)
{
UsedBullets += value;
}
public void SetHits(int value)
{
Hits = value;
}
public void IncHits(int value)
{
Hits += value;
}
public void SetHighScore(int value)
{
HighScore = value;
}
public void SetHeath(int value)
{
Health = value;
}
public void DecHealth(int value)
{
Health -= value;
if (Health < 0)
{
Health = 0;
}
}
public int GetHits()
{
return Hits;
}
public int GetUsedBullets()
{
return UsedBullets;
}
public int GetHealth()
{
return Health;
}
public int GetHighScore()
{
return HighScore;
}
public void IncHighScore(int incValue)
{
SmHighScore += incValue;
if (SmHighScore > 50) {
HighScore += 10;
SmHighScore = 0;
}
}
public void BonusSetHigh(int value, bool inc)
{
if (inc)
{
HighScore += value;
}
else
{
HighScore -= value;
}
}
}
}