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;
|
2023-04-01 15:36:02 +08:00
|
|
|
|
if (pc)
|
|
|
|
|
pc.Caught();
|
2023-03-30 15:26:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnExit()
|
|
|
|
|
{
|
|
|
|
|
animator.Stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void update()
|
|
|
|
|
{
|
|
|
|
|
timer -= Time.DeltaTimeF;
|
|
|
|
|
if(timer <= 0.0f)
|
|
|
|
|
{
|
|
|
|
|
if (pc)
|
|
|
|
|
{
|
2023-04-01 15:36:02 +08:00
|
|
|
|
|
|
|
|
|
pc.Reset();
|
2023-03-30 15:26:15 +08:00
|
|
|
|
}
|
|
|
|
|
ai.Reset();
|
|
|
|
|
}
|
2023-04-01 15:36:02 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Transform pcTransform = pc.GetComponent<Transform>();
|
|
|
|
|
Transform netTransform = ai.attackHitbox.GetComponentInChildren<Transform>();
|
|
|
|
|
if (pcTransform && netTransform)
|
|
|
|
|
{
|
|
|
|
|
pcTransform.GlobalPosition = netTransform.GlobalPosition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-03-30 15:26:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void fixedUpdate()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|