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

50 lines
967 B
C#
Raw Normal View History

2023-03-24 13:26:18 +08:00
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;
2023-03-25 14:51:28 +08:00
float alertCooldown = 1.0f;
2023-03-24 13:26:18 +08:00
public TimeoutState(StateMachine machine) : base(machine)
{
stateName = "Timeout";
}
public override void OnEnter()
{
timer = 0.0f;
2023-03-25 14:51:28 +08:00
animator.Play(ai.idleAnim);
2023-03-24 13:26:18 +08:00
}
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;
}
}
}