diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs index acf85953..61328296 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs @@ -4,37 +4,43 @@ 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 class HomeOwnerAttackHitbox : Script + { + public GameObject aiGO; + protected override void update() { - public GameObject aiGO; - protected override void update() - { - Transform transform = GetComponent(); - Transform aiTransform = aiGO.GetComponent(); - - if(transform) - { - transform.GlobalPosition = aiTransform.GlobalPosition; - } - } - - - protected override void onTriggerStay(CollisionInfo info) - { - - PlayerController pc = info.GameObject.GetScript(); - HomeOwnerAI ai = aiGO.GetScript(); - if (pc) - { - pc.GotCaught(); - if(ai) - ai.Reset(); - } - } - + Transform transform = GetComponent(); + Transform aiTransform = aiGO.GetComponent(); + if (transform) + { + transform.GlobalPosition = aiTransform.GlobalPosition; + transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles; + } } + + + protected override void onTriggerStay(CollisionInfo info) + { + + PlayerController pc = info.GameObject.GetScript(); + HomeOwnerAI ai = aiGO.GetScript(); + 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(); + } + } + + + } } diff --git a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs index d82c54ab..95a08383 100644 --- a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs +++ b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs @@ -510,9 +510,10 @@ public class PlayerController : Script currentState = RaccoonStates.IDLE; if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState))) stateMachine.SetState(typeof(PlayerIdleState)); - tranform.LocalPosition = respawnPoint.GetComponent().LocalPosition; - GameManager.Instance.RacoonCaught(); + tranform.GlobalPosition = respawnPoint.GetComponent().GlobalPosition; + + GameManager.Instance.RacoonCaught(); if (pat && pat.item) {