-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTEAM_BLUE_SCRIPT.cs
225 lines (200 loc) · 7.61 KB
/
TEAM_BLUE_SCRIPT.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//---------- CHANGE THIS NAME HERE -------
public class marker : MonoBehaviour
{
public ObjectiveScript middleObjective;
public ObjectiveScript leftObjective;
public ObjectiveScript rightObjective;
public float timer = 0;
//---------- CHANGE THIS NAME HERE -------
public static marker AddYourselfTo(GameObject host) {
//---------- CHANGE THIS NAME HERE -------
return host.AddComponent<marker>();
}
/*vvvv DO NOT MODIFY vvvvv*/
[SerializeField]
public CharacterScript character1;
[SerializeField]
public CharacterScript character2;
[SerializeField]
public CharacterScript character3;
void Start()
{
// populate the objectives
middleObjective = GameObject.Find("MiddleObjective").GetComponent<ObjectiveScript>();
leftObjective = GameObject.Find("LeftObjective").GetComponent<ObjectiveScript>();
rightObjective = GameObject.Find("RightObjective").GetComponent<ObjectiveScript>();
character1 = transform.Find("Character1").gameObject.GetComponent<CharacterScript>();
character2 = transform.Find("Character2").gameObject.GetComponent<CharacterScript>();
character3 = transform.Find("Character3").gameObject.GetComponent<CharacterScript>();
}
/*^^^^ DO NOT MODIFY ^^^^*/
/* Your code below this line */
bool char1HasMoved = false;
// Update() is called every frame
void Update()
{
basicUpdate(character1);
basicUpdate(character2);
basicUpdate(character3);
Char1();
Char2();
Char3();
}
/*
* function for all charachter to run every turn
*/
void basicUpdate(CharacterScript character)
{
//Set caracter loadouts, can only happen when the characters are at base.
// in the first couple of seconds we just scan around
if (timer < 10)
{
character.FaceClosestWaypoint();
}
}
void Char1()
{
//set loadout
if (character1.getZone() == zone.BlueBase || character1.getZone() == zone.RedBase)
{
character1.setLoadout(loadout.SHORT);
}
character1.FaceClosestWaypoint();
character1.isDoneMoving();
if(goToNearItem(character1)) {
}
else if (middleObjective.getControllingTeam() != character1.getTeam())
{
character1.MoveChar(leftObjective.transform.position);
character1.SetFacing(leftObjective.transform.position);
if(character1.attackedFromLocations.Count>0)
{
character1.FindClosestCover(character1.attackedFromLocations[0]);
}
}
/*
// place sniper in position, run to cover if attacked
if (character1.attackedFromLocations.Capacity == 0)
{
character1.MoveChar(new Vector3(-8.8f, 1.5f, 13.5f));
character1.SetFacing(middleObjective.transform.position);
}
else
{
character1.MoveChar(character1.FindClosestCover(character1.attackedFromLocations[0]));
}
*/
}
void Char2()
{
//Debug.Log(rightObjective.getControllingTeam());
//sendToCapture(character2);
//character2.FaceClosestWaypoint();
//character2.MoveChar(middleObjective.transform.position);
if(goToNearItem(character2)) {
}
else if (rightObjective.getControllingTeam() != character2.getTeam())
{
character2.MoveChar(rightObjective.transform.position);
character2.SetFacing(rightObjective.transform.position);
}
/*
if (middleObjective.getControllingTeam() != character2.getTeam())
{
character2.MoveChar(middleObjective.transform.position);
character2.SetFacing(middleObjective.transform.position);
}
if ((rightObjective.getControllingTeam() == character2.getTeam()) & (rightObjective.getControllingTeam() == character2.getTeam()));
{
if(character2.attackedFromLocations.Count>0)
{
character2.FindClosestCover(character2.attackedFromLocations[0]);
}
character2.isDoneMoving();
}
*/
}
//Agresssive attacc Charachter
void Char3()
{
if(goToNearItem(character3)) {
}
else {
character3.MoveChar(middleObjective.transform.position);
character3.SetFacing(middleObjective.transform.position);
}
}
void sendToCapture(CharacterScript character)
{
// send other two to capture
if (middleObjective.getControllingTeam() != character1.getTeam())
{
character.MoveChar(rightObjective.transform.position);
character.SetFacing(rightObjective.transform.position);
if (character.attackedFromLocations.Capacity != 0)
{
character.FindClosestCover(character.attackedFromLocations[0]);
}
}
else
{
// Then RIght
if (rightObjective.getControllingTeam() != character1.getTeam())
{
character.MoveChar(rightObjective.transform.position);
character.SetFacing(rightObjective.transform.position);
}
// Then left
if (leftObjective.getControllingTeam() != character1.getTeam())
{
character.MoveChar(leftObjective.transform.position);
character.SetFacing(leftObjective.transform.position);
}
}
}
bool goToNearItem(CharacterScript character) {
if(Vector3.Distance(character.getPrefabObject().transform.position, character.FindClosestItem().transform.position)<5)
{
character.MoveChar(character.FindClosestItem().transform.position);
character.SetFacing(character.FindClosestItem().transform.position);
return true;
}
return false;
}
}
/*
if (character1.getZone() == zone.BlueBase || character1.getZone() == zone.RedBase)
{
character1.setLoadout(loadout.SHORT);
}
character1.FaceClosestWaypoint();
if (middleObjective.getControllingTeam() != character1.getTeam())
{
character1.MoveChar(leftObjective.transform.position);
character1.SetFacing(leftObjective.transform.position);
character1.FindClosestCover(character1.attackedFromLocations[0]);
}
character1.isDoneMoving();
if (character1.getHP() <= 40)
{
character1.FindClosestItem();
}
if (rightObjective.getControllingTeam() != character2.getTeam())
{
character2.MoveChar(rightObjective.transform.position);
character2.SetFacing(rightObjective.transform.position);
}
if (middleObjective.getControllingTeam() != character.getTeam())
{
character2.MoveChar(middleObjective.transform.position);
character2.SetFacing(middleObjective.transform.position);
}
if ((rightObjective.getControllingTeam() = character2.getTeam()) & (rightObjective.getControllingTeam() = character2.getTeam()));
{
character2.FindClosestCover(character2.attackedFromLocations[0]);
character2.isDoneMoving();
}
*/