SHADE_Y3/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/TimeoutState.cs

50 lines
967 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SHADE;
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{
public class TimeoutState : AIBaseState
{
float timer = 0.0f;
float alertCooldown = 1.0f;
public TimeoutState(StateMachine machine) : base(machine)
{
stateName = "Timeout";
}
public override void OnEnter()
{
timer = 0.0f;
animator.Play(ai.idleAnim);
}
public override void update()
{
timer += Time.DeltaTimeF;
if (timer >= ai.timeoutDuration)
{
machine.SetState(typeof(PatrolState));
}
}
public override void fixedUpdate()
{
}
public override void OnExit()
{
ai.alertCooldown = alertCooldown;
}
}
}