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.
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using MalbersAnimations.Scriptables;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace MalbersAnimations.Controller.AI
|
|
{
|
|
[CreateAssetMenu(menuName = "Malbers Animations/Pluggable AI/Decision/Wait", order = 201)]
|
|
public class WaitDecision : MAIDecision
|
|
{
|
|
public override string DisplayName => "General/Wait";
|
|
|
|
[Space]
|
|
/// <summary>Range for Looking forward and Finding something</summary>
|
|
public FloatReference WaitMinTime = new FloatReference(5);
|
|
public FloatReference WaitMaxTime = new FloatReference(5);
|
|
|
|
public override void PrepareDecision(MAnimalBrain brain, int Index)
|
|
{
|
|
//Store the time we want to wait on the Local Decision Float var
|
|
brain.DecisionsVars[Index].floatValue = UnityEngine.Random.Range(WaitMinTime, WaitMaxTime);
|
|
}
|
|
|
|
public override bool Decide(MAnimalBrain brain,int Index)
|
|
{
|
|
var WaitTime = brain.DecisionsVars[Index].floatValue;
|
|
|
|
bool timepassed = MTools.ElapsedTime(brain.StateLastTime, WaitTime);
|
|
|
|
return timepassed;
|
|
}
|
|
}
|
|
}
|