-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEtmanVehicleAiController.uc
78 lines (61 loc) · 1.83 KB
/
EtmanVehicleAiController.uc
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
class EtmanVehicleAiController extends AIController;
const NODES_DISTANCE=1600; // approximate distance between every node and the nearst ones to it
const HIDE_TIME= 25; // in seconds
const COLLISION_RADIOUS = 20 ; /// the space between the player and the collision where it stop at
var array<EtmanPathNode_Traffic> trafficNodes;
var EtmanPathNode_Traffic node;
var EtmanPathNode_Traffic lastVisitedNode;
var Vector newLocation ;
NewLocation += normal(NodeImGoingTo.Location - Location) * 128; // 128 is the distance offset
simulated function PostBeginPlay()
{
super.PostBeginPlay();
`Log("########__ Controller for vehicle is Here __########");
}
event Possess(Pawn aPawn , bool bVehicleTransition)
{
Super.Possess(aPawn , bVehicleTransition);
//Pawn.SetMovementPhysics();
`Log("########__ Pawn -> "@ Pawn @" __########");
}
event Tick()
{
/// 1. get destination from the player to the Pawn
/// 2. if it's less than 20 unite it goes to state IDLE
}
state GettingReady
{
Begin :
Sleep(3);
`log("#####__ Now I'm ready to rock and roll ^^ __#####");
GotoState('Wandering');
} /// i do shit
auto state Wandering
{
Begin:
sleep(0.8);
trafficNodes.Length = 0;
foreach VisibleActors(class'EtmanPathNode_Traffic' , node , NODES_DISTANCE , Pawn.Location )
{
if(!node.Hidden )
{
`Log("########__ Taken Node -> "@ node @" __########");
trafficNodes.AddItem(node);
}
}
if (TrafficNodes.Length != 0)
{
node = TrafficNodes[Rand(trafficNodes.Length)];
`Log("########__ Moving to -> "@ node @" __########");
MoveTo(node.Location , node);
node.Hide(HIDE_TIME);
}
GoTo('Begin');
}
state IDLE
{
/// the bot will stop moving
}
defaultProperties
{
}