You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
868 B
C#
27 lines
868 B
C#
using MalbersAnimations.Scriptables;
|
|
using UnityEngine;
|
|
|
|
namespace MalbersAnimations.Controller.AI
|
|
{
|
|
[CreateAssetMenu(menuName = "Malbers Animations/Pluggable AI/Tasks/Wait")]
|
|
public class WaitTask : MTask
|
|
{
|
|
public override string DisplayName => "General/Wait";
|
|
|
|
[Space]
|
|
public FloatReference WaitMinTime = new FloatReference(5);
|
|
public FloatReference WaitMaxTime = new FloatReference(5);
|
|
|
|
public override void StartTask(MAnimalBrain brain, int index)
|
|
{
|
|
brain.TasksVars[index].floatValue = UnityEngine.Random.Range(WaitMinTime, WaitMaxTime);
|
|
}
|
|
|
|
public override void UpdateTask(MAnimalBrain brain, int index)
|
|
{
|
|
if (MTools.ElapsedTime(brain.TasksStartTime[index], brain.TasksVars[index].floatValue))
|
|
brain.TaskDone(index);
|
|
}
|
|
}
|
|
}
|