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

56 lines
1.1 KiB
C#
Raw Normal View History

using SHADE;
2023-03-24 13:26:18 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{
public class AlertState: AIBaseState
{
2023-03-25 14:51:28 +08:00
const float alertDuration = 16.0f/30.0f + 1.0f;
2023-03-24 13:26:18 +08:00
float alertTimer = alertDuration;
public AlertState(StateMachine machine): base(machine)
{
stateName = "Alert";
}
public override void OnEnter()
{
alertTimer = alertDuration;
2023-03-25 14:51:28 +08:00
if(animator)
{
animator.PlayOneShot(ai.alertAnim);
}
SHADE.Audio.SetParameterWithLabel("PlayerDetection", "Detected");
2023-03-25 14:51:28 +08:00
}
public override void OnExit()
{
animator.Stop();
2023-03-24 13:26:18 +08:00
}
public override void update()
{
alertTimer -= Time.DeltaTimeF;
if (alertTimer <= 0.0f)
{
machine.SetState(typeof(ChaseState));
}
2023-03-25 14:51:28 +08:00
2023-03-24 13:26:18 +08:00
}
2023-03-25 14:51:28 +08:00
2023-03-24 13:26:18 +08:00
public override void fixedUpdate()
{
}
}
}