SHADE_Y3/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs

47 lines
1.1 KiB
C#
Raw Normal View History

2023-03-25 14:51:28 +08:00
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2023-03-25 17:20:35 +08:00
using static PlayerController;
2023-03-25 14:51:28 +08:00
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
{
2023-03-25 17:20:35 +08:00
public class HomeOwnerAttackHitbox : Script
{
public GameObject aiGO;
protected override void update()
2023-03-25 14:51:28 +08:00
{
2023-03-25 17:20:35 +08:00
Transform transform = GetComponent<Transform>();
Transform aiTransform = aiGO.GetComponent<Transform>();
2023-03-25 16:52:26 +08:00
2023-03-25 17:20:35 +08:00
if (transform)
{
2023-03-25 17:29:03 +08:00
transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 2.2f; ;
2023-03-25 17:20:35 +08:00
transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles;
}
}
2023-03-25 16:52:26 +08:00
2023-03-25 17:20:35 +08:00
protected override void onTriggerStay(CollisionInfo info)
{
2023-03-25 14:51:28 +08:00
2023-03-25 17:20:35 +08:00
PlayerController pc = info.GameObject.GetScript<PlayerController>();
HomeOwnerAI ai = aiGO.GetScript<HomeOwnerAI>();
if (pc)
{
pc.currentState = RaccoonStates.CAUGHT;
if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState)))
pc.stateMachine.SetState(typeof(PlayerCaughtState));
2023-03-25 14:51:28 +08:00
2023-03-25 17:20:35 +08:00
pc.GotCaught();
if (ai)
ai.Reset();
}
2023-03-25 14:51:28 +08:00
}
2023-03-25 17:20:35 +08:00
}
2023-03-25 14:51:28 +08:00
}