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

63 lines
1.0 KiB
C#
Raw Normal View History

2023-03-30 15:26:15 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SHADE;
using static PlayerController;
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{
public class CaughtRaccoonState: AIBaseState
{
private float timer = 0.0f;
private PlayerController pc;
public CaughtRaccoonState(StateMachine machine):base(machine)
{
stateName = "Caught Raccoon";
}
public override void OnEnter()
{
if(ai.hitboxScript)
pc = ai.hitboxScript.pc;
timer = ai.caughtDuration;
}
public override void OnExit()
{
animator.Stop();
}
public override void update()
{
timer -= Time.DeltaTimeF;
if(timer <= 0.0f)
{
if (pc)
{
pc.currentState = RaccoonStates.CAUGHT;
if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState)))
pc.stateMachine.SetState(typeof(PlayerCaughtState));
pc.GotCaught();
}
ai.Reset();
}
}
public override void fixedUpdate()
{
}
}
}