47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using SHADE;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using static PlayerController;
|
|
|
|
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
|
|
{
|
|
public class HomeOwnerAttackHitbox : Script
|
|
{
|
|
public GameObject aiGO;
|
|
protected override void update()
|
|
{
|
|
Transform transform = GetComponent<Transform>();
|
|
Transform aiTransform = aiGO.GetComponent<Transform>();
|
|
|
|
if (transform)
|
|
{
|
|
transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 2.2f; ;
|
|
transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles;
|
|
}
|
|
}
|
|
|
|
|
|
protected override void onTriggerStay(CollisionInfo info)
|
|
{
|
|
|
|
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));
|
|
|
|
pc.GotCaught();
|
|
if (ai)
|
|
ai.Reset();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|