37 lines
815 B
C#
37 lines
815 B
C#
|
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()
|
||
|
{
|
||
|
currentWaitTime = iPatrol.GetCurrentWayPoint().WaitTime;
|
||
|
|
||
|
time = 0f;
|
||
|
}
|
||
|
|
||
|
public override TaskStatus OnUpdate()
|
||
|
{
|
||
|
time += Time.deltaTime;
|
||
|
|
||
|
if (time < currentWaitTime)
|
||
|
{
|
||
|
return TaskStatus.Running;
|
||
|
}
|
||
|
|
||
|
return TaskStatus.Success;
|
||
|
}
|
||
|
}
|
||
|
}
|