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