Fixed AI C# Script for final submission #283
|
@ -41,7 +41,15 @@ public partial class LeafAttack : BehaviourTreeNode
|
|||
onEnter(BehaviourTreeNodeStatus.RUNNING);
|
||||
|
||||
//Succeed when stand in hurt box for long enough
|
||||
float captureTime = (float)GetNodeData("captureTimeLeft");
|
||||
//Debug.Log("Attempting to get blackboard data");
|
||||
float? captureTime = (float?)GetNodeData("captureTimeLeft");
|
||||
//Debug.Log("Got blackboard data");
|
||||
if (captureTime == null)
|
||||
{
|
||||
status = BehaviourTreeNodeStatus.FAILURE;
|
||||
onExit(BehaviourTreeNodeStatus.FAILURE);
|
||||
return status;
|
||||
}
|
||||
captureTime -= Time.DeltaTimeF;
|
||||
SetNodeData("captureTimeLeft", captureTime);
|
||||
//Debug.Log(captureTime.ToString());
|
||||
|
|
|
@ -119,7 +119,7 @@ public partial class LeafChase : BehaviourTreeNode
|
|||
//Play SFX
|
||||
if (GetNodeData("isCapturing") != null && (bool)GetNodeData("isCapturing") == false)
|
||||
{
|
||||
Debug.Log("AI Play capturing SFX");
|
||||
//Debug.Log("AI Play capturing SFX");
|
||||
}
|
||||
SetNodeData("isCapturing", true);
|
||||
|
||||
|
|
|
@ -84,6 +84,10 @@ public partial class LeafPatrol : BehaviourTreeNode
|
|||
}
|
||||
|
||||
waypoints = (List<GameObject>)GetNodeData("waypoints");
|
||||
if (waypoints == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Vector3 targetPosition = waypoints[currentWaypointIndex].GetComponent<Transform>().GlobalPosition;
|
||||
|
||||
//Reach waypoint by X and Z being near enough
|
||||
|
|
Loading…
Reference in New Issue