2024-02-12 20:50:24 +00:00
|
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
namespace BlueWaterProject
|
|
|
|
{
|
|
|
|
public class PatrolWait : Action
|
|
|
|
{
|
|
|
|
private IPatrol iPatrol;
|
|
|
|
private float currentWaitTime;
|
|
|
|
private float time;
|
|
|
|
|
|
|
|
public override void OnAwake()
|
|
|
|
{
|
|
|
|
iPatrol = transform.GetComponent<IPatrol>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnStart()
|
|
|
|
{
|
2024-03-05 03:47:17 +00:00
|
|
|
currentWaitTime = iPatrol.GetCurrentWayPointInfo().WaitTime;
|
2024-02-12 20:50:24 +00:00
|
|
|
|
|
|
|
time = 0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override TaskStatus OnUpdate()
|
|
|
|
{
|
|
|
|
time += Time.deltaTime;
|
|
|
|
|
|
|
|
if (time < currentWaitTime)
|
|
|
|
{
|
|
|
|
return TaskStatus.Running;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TaskStatus.Success;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|