-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathReferee.cpp
More file actions
80 lines (64 loc) · 2.11 KB
/
Copy pathReferee.cpp
File metadata and controls
80 lines (64 loc) · 2.11 KB
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
// This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public License as published by the Free Software Foundation
#include "Referee.h"
// Sets default values
AReferee::AReferee()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AReferee::BeginPlay()
{
Super::BeginPlay();
}
msr::airlib::CarApiBase::RefereeState AReferee::getState() {
return this->state;
}
// Called every frame
void AReferee::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
int32 AReferee::ConeHit(FString coneName)
{
return (int32) (++state.doo_counter);
}
int32 AReferee::LapCompleted(float lapTime)
{
state.laps.push_back(lapTime);
return state.laps.size();
}
void AReferee::AppendYellowCone(FTransform transform) {
msr::airlib::CarApiBase::Cone cone;
cone.location.x = transform.GetTranslation().X;
cone.location.y = transform.GetTranslation().Y;
cone.color = msr::airlib::CarApiBase::ConeColor::Yellow;
state.cones.push_back(cone);
}
void AReferee::AppendBlueCone(FTransform transform) {
msr::airlib::CarApiBase::Cone cone;
cone.location.x = transform.GetTranslation().X;
cone.location.y = transform.GetTranslation().Y;
cone.color = msr::airlib::CarApiBase::ConeColor::Blue;
state.cones.push_back(cone);
}
void AReferee::AppendBigOrangeCone(FTransform transform){
msr::airlib::CarApiBase::Cone cone;
cone.location.x = transform.GetTranslation().X;
cone.location.y = transform.GetTranslation().Y;
cone.color = msr::airlib::CarApiBase::ConeColor::OrangeLarge;
state.cones.push_back(cone);
}
void AReferee::AppendSmallOrangeCone(FTransform transform){
msr::airlib::CarApiBase::Cone cone;
cone.location.x = transform.GetTranslation().X;
cone.location.y = transform.GetTranslation().Y;
cone.color = msr::airlib::CarApiBase::ConeColor::OrangeSmall;
state.cones.push_back(cone);
}
void AReferee::LoadStartPos(FVector pos) {
msr::airlib::CarApiBase::Point2D point;
point.x = pos.X;
point.y = pos.Y;
state.car_start_location = point;
}