From 6c1f0162e944c9425fbde415ef056aef9933639e Mon Sep 17 00:00:00 2001 From: maverickdgg Date: Sat, 25 Mar 2023 17:29:03 +0800 Subject: [PATCH] Attack hitbox change --- .../AIRework/HomeOwnerAttackHitbox.cs | 2 +- .../AIBehaviour/AIRework/States/AttackState.cs | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs index 61328296..08b3c2a5 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs @@ -18,7 +18,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework if (transform) { - transform.GlobalPosition = aiTransform.GlobalPosition; + transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 2.2f; ; transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles; } } diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs index 1460fdc8..f2fd6c59 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs @@ -14,12 +14,14 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States float windupTime = 8.0f / 30.0f; float holdTime = 0.3f; - float seqTime = 8.0f / 30.0f + 0.5f; + float seqTime = 8.0f / 30.0f; + float endTime = 0.5f; bool windUp = false; bool hold = false; bool seq = false; + bool end = false; public AttackState(StateMachine machine): base(machine) { @@ -34,6 +36,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States windUp = true; hold = false; seq = false; + end = false; timer = windupTime; RotateToVelocity rotate = machine.GetScript(); @@ -106,9 +109,20 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States if(timer <= 0.0f) { seq = false; + end = true; + animator.PlayOneShot(ai.atkSeqAnim); + timer = endTime; + + } + } + else if(end) + { + if(timer <= 0.0f) + { + end = false; AILineOfSight los = ai.GetScript(); - if(los && los.withinSight) + if (los && los.withinSight) { machine.SetState(typeof(ChaseState)); }