Added object checks in leaf scripts
This commit is contained in:
parent
46ae50949e
commit
d72a532623
|
@ -8676,15 +8676,7 @@
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: Homeowner1
|
- Type: Homeowner1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
player: 2
|
waypointsPool: 51000
|
||||||
waypoints:
|
|
||||||
- [2.70000005, 0, -2]
|
|
||||||
- [-0.300000012, 0, -2.70000005]
|
|
||||||
- [-2, 0, -3.79999995]
|
|
||||||
- [-4, 0, -2.0999999]
|
|
||||||
- [-2.9000001, 0, 2.4000001]
|
|
||||||
- [-1, 0, 4]
|
|
||||||
- [2.70000005, 0, 4]
|
|
||||||
patrolSpeed: 1
|
patrolSpeed: 1
|
||||||
chaseSpeed: 2
|
chaseSpeed: 2
|
||||||
turningSpeed: 5
|
turningSpeed: 5
|
||||||
|
|
|
@ -40,8 +40,14 @@ public partial class LeafAttack : BehaviourTreeNode
|
||||||
|
|
||||||
onEnter(BehaviourTreeNodeStatus.RUNNING);
|
onEnter(BehaviourTreeNodeStatus.RUNNING);
|
||||||
|
|
||||||
//Succeed when stand in hurt box for long enough
|
//Succeed when stand in hurt box for long enough
|
||||||
float captureTime = (float)GetNodeData("captureTimeLeft");
|
object timeObj = GetNodeData("captureTimeLeft");
|
||||||
|
if (timeObj == null)
|
||||||
|
{
|
||||||
|
return BehaviourTreeNodeStatus.FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
float captureTime = (float)GetNodeData("captureTimeLeft");
|
||||||
captureTime -= Time.DeltaTimeF;
|
captureTime -= Time.DeltaTimeF;
|
||||||
SetNodeData("captureTimeLeft", captureTime);
|
SetNodeData("captureTimeLeft", captureTime);
|
||||||
//Debug.Log(captureTime.ToString());
|
//Debug.Log(captureTime.ToString());
|
||||||
|
|
|
@ -83,7 +83,13 @@ public partial class LeafPatrol : BehaviourTreeNode
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
waypoints = (List<GameObject>)GetNodeData("waypoints");
|
object waypoint = GetNodeData("waypoints");
|
||||||
|
if (waypoint == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
waypoints = (List<GameObject>)waypoint;
|
||||||
Vector3 targetPosition = waypoints[currentWaypointIndex].GetComponent<Transform>().GlobalPosition;
|
Vector3 targetPosition = waypoints[currentWaypointIndex].GetComponent<Transform>().GlobalPosition;
|
||||||
|
|
||||||
//Reach waypoint by X and Z being near enough
|
//Reach waypoint by X and Z being near enough
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class MainMenu : Script
|
||||||
if (Input.GetKey(Input.KeyCode.Space))
|
if (Input.GetKey(Input.KeyCode.Space))
|
||||||
{
|
{
|
||||||
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||||
SceneManager.ChangeScene(86098106);
|
SceneManager.ChangeScene(89830755);
|
||||||
Audio.StopAllSounds();
|
Audio.StopAllSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue