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

54 lines
1.1 KiB
C#
Raw Permalink 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;
using SHADE_Scripting.Audio;
2023-03-24 13:26:18 +08:00
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);
SHADE.Audio.SetParameterWithLabel("HomeownerBark", "DetectLost");
AudioHandler.audioClipHandlers["HO_bark"].Play();
}
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;
}
}
}