OldBlueWater/BlueWater/Assets/02.Scripts/Ai/BehaviorTree/Task/PirateShip/PatrolWait.cs

37 lines
819 B
C#
Raw Normal View History

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.GetCurrentWayPointInfo().WaitTime;
time = 0f;
}
public override TaskStatus OnUpdate()
{
time += Time.deltaTime;
if (time < currentWaitTime)
{
return TaskStatus.Running;
}
return TaskStatus.Success;
}
}
}