-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecisionTreeController.cs
More file actions
30 lines (24 loc) · 889 Bytes
/
Copy pathDecisionTreeController.cs
File metadata and controls
30 lines (24 loc) · 889 Bytes
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
using UnityEngine;
using System.Collections;
public class DecisionTreeController : Controller {
private int sightRng = 2;
private SGEInSight node = new SGEInSight();
override public void Move(out int xDir, out int yDir)
{
GameObject player = Utils.GetPlayerGameObject();
Vector2 playerPosition = (Vector2)player.transform.position;
Vector2 exitPosition = Utils.GetExitPosition();
//Safe Gamestate
GameObject[,] gamestate = Utils.GetMapWithFloor();
//Call DecisionTree to get a proper action for the current gamestate
ActionTreeNode action = node.makeDecision(sightRng);
Debug.Log("Got Action"+action);
int xDir2, yDir2;
xDir = 1;
yDir = 0;
//Do proper action
action.doAction(sightRng, out xDir2, out yDir2);
xDir = xDir2;
yDir = yDir2;
}
}