-
Notifications
You must be signed in to change notification settings - Fork 0
/
Target.cpp
53 lines (46 loc) · 1.41 KB
/
Target.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
#include <math.h>
#include "Target.h"
Target::Target(Target::ID id) {
switch (id) {
case LOW:
position = Team3499::Point(635,39);
rectangle = Team3499::Rect(Team3499::Point(270,33), Team3499::Point(299,19));
value = 1;
break;
case LMEDIUM:
position = Team3499::Point(648,234);
rectangle = Team3499::Rect(Team3499::Point(63,110), Team3499::Point(117,89));
value = 2;
break;
case RMEDIUM:
position = Team3499::Point(648,90);
rectangle = Team3499::Rect(Team3499::Point(207,110), Team3499::Point(261,89));
value = 2;
break;
case HIGH:
position = Team3499::Point(648,162);
rectangle = Team3499::Rect(Team3499::Point(135,116), Team3499::Point(189,104));
value = 3;
break;
default:
break;
}
}
Team3499::Point Target::Position() const {
return position;
}
Team3499::Rect Target::Rectangle() const {
return rectangle;
}
int Target::Height() const {
return rectangle.Center().y;
}
int Target::Value() const {
return value;
}
int Target::DistanceTo(const Team3499::Point &point) const {
return (int)sqrt(pow(HDistanceTo(point), 2) + pow(Height(), 2));
}
int Target::HDistanceTo(const Team3499::Point &point) const {
return point.DistanceTo(position);
}