2023-03-25 14:51:28 +08:00
|
|
|
|
using SHADE;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2023-03-25 18:18:29 +08:00
|
|
|
|
using System.Threading;
|
2023-03-25 14:51:28 +08:00
|
|
|
|
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;
|
2023-03-25 18:18:29 +08:00
|
|
|
|
|
|
|
|
|
Transform transform;
|
|
|
|
|
Transform aiTransform;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override void start()
|
2023-03-25 14:51:28 +08:00
|
|
|
|
{
|
2023-03-25 18:18:29 +08:00
|
|
|
|
transform = GetComponent<Transform>();
|
|
|
|
|
aiTransform = aiGO.GetComponent<Transform>();
|
|
|
|
|
}
|
2023-03-25 16:52:26 +08:00
|
|
|
|
|
2023-03-25 18:18:29 +08:00
|
|
|
|
protected override void update()
|
|
|
|
|
{
|
|
|
|
|
if (transform && aiTransform)
|
2023-03-25 17:20:35 +08:00
|
|
|
|
{
|
2023-03-25 18:18:29 +08:00
|
|
|
|
|
|
|
|
|
transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 0.7f;
|
2023-03-25 17:20:35 +08:00
|
|
|
|
transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles;
|
2023-03-25 18:18:29 +08:00
|
|
|
|
|
2023-03-25 17:20:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
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)
|
|
|
|
|
{
|
2023-03-25 18:18:29 +08:00
|
|
|
|
//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 18:18:29 +08:00
|
|
|
|
//pc.GotCaught();
|
2023-03-25 17:20:35 +08:00
|
|
|
|
if (ai)
|
2023-03-25 18:18:29 +08:00
|
|
|
|
{
|
|
|
|
|
ai.Reset();
|
|
|
|
|
GameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-25 17:20:35 +08:00
|
|
|
|
}
|
2023-03-25 14:51:28 +08:00
|
|
|
|
}
|
2023-03-25 17:20:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-03-25 14:51:28 +08:00
|
|
|
|
}
|