27 lines
688 B
C#
27 lines
688 B
C#
|
using System;
|
|||
|
using BehaviorDesigner.Runtime.Tasks;
|
|||
|
using BlueWater.Enemies;
|
|||
|
using Action = BehaviorDesigner.Runtime.Tasks.Action;
|
|||
|
|
|||
|
namespace BlueWater.BehaviorTrees.Actions
|
|||
|
{
|
|||
|
[TaskCategory("Custom")]
|
|||
|
[Serializable]
|
|||
|
public class HasReachedDestination : Action
|
|||
|
{
|
|||
|
private AiMovement _aiMovement;
|
|||
|
|
|||
|
public override void OnAwake()
|
|||
|
{
|
|||
|
_aiMovement = transform.GetComponent<AiMovement>();
|
|||
|
}
|
|||
|
|
|||
|
public override TaskStatus OnUpdate()
|
|||
|
{
|
|||
|
if (!_aiMovement.HasReachedDestination()) return TaskStatus.Running;
|
|||
|
|
|||
|
_aiMovement.StopMove();
|
|||
|
return TaskStatus.Success;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|