From 8ffca03f162aa2424206dfb691705e498cb568f3 Mon Sep 17 00:00:00 2001 From: Glence Date: Sun, 2 Apr 2023 13:32:21 +0800 Subject: [PATCH] AI fix --- .../AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs | 10 ++++++---- .../AIBehaviour/AIRework/States/AttackState.cs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs index 6f392962..54dc2834 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs @@ -50,11 +50,13 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework protected override void onTriggerStay(CollisionInfo info) { - if(info.GameObject.GetScript()) + if (info.GameObject.GetScript()) + { pc = info.GameObject.GetScript(); - if (ai && ai.atk && pc) - { - raccoonFound = true; + if (ai && ai.atk && pc) + { + raccoonFound = true; + } } } diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs index e7162086..29005980 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs @@ -88,7 +88,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States public override void update() { - if (ai.hitboxScript.raccoonFound) + if (ai.hitboxScript.raccoonFound && machine.GetScript().atk) { raccoonCaught = true; Transform pcTransform = ai.player.GetComponent();