diff --git a/Assets/Scenes/Level2.shade b/Assets/Scenes/Level2.shade index e1934259..4e8e6879 100644 --- a/Assets/Scenes/Level2.shade +++ b/Assets/Scenes/Level2.shade @@ -5535,7 +5535,7 @@ - Is Trigger: false Collision Tag: 5 Type: Box - Half Extents: {x: 0.600000024, y: 1.79999995, z: 0.400000006} + Half Extents: {x: 0.200000003, y: 1.79999995, z: 0.200000003} Friction: 0.400000006 Bounciness: 0 Density: 1 diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs index f97ef995..d522189c 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs @@ -127,14 +127,17 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework private void AICheat() { StateMachine machine = GetScript(); - if(machine) + AILineOfSight los = GetScript(); + if(machine && los) { - if (Input.GetKeyDown(Input.KeyCode.F)) + if (Input.GetKeyDown(Input.KeyCode.K)) { + los.range = 5.0f; machine.SetState(typeof(AlertState)); } if(Input.GetKeyDown(Input.KeyCode.L)) { + los.range = 0.0f; machine.SetState(typeof(IdleState)); } diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs index db381906..1c9ac802 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs @@ -42,11 +42,11 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework HomeOwnerAI ai = aiGO.GetScript(); if (pc) { - //pc.currentState = RaccoonStates.CAUGHT; - //if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState))) - // pc.stateMachine.SetState(typeof(PlayerCaughtState)); + pc.currentState = RaccoonStates.CAUGHT; + if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState))) + pc.stateMachine.SetState(typeof(PlayerCaughtState)); - //pc.GotCaught(); + pc.GotCaught(); if (ai) { ai.Reset(); diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs index f2fd6c59..cd25ef9d 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs @@ -14,7 +14,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States float windupTime = 8.0f / 30.0f; float holdTime = 0.3f; - float seqTime = 8.0f / 30.0f; + float seqTime = 8.0f / 30.0f ; float endTime = 0.5f; @@ -48,8 +48,19 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States { rigid.LinearVelocity = Vector3.Zero; } + Transform transform = machine.GetComponent(); + AILineOfSight los = machine.GetScript(); + Transform playerTransform = ai.player.GetComponent(); + if (los && transform) + { + Vector3 direction = playerTransform.GlobalPosition - transform.GlobalPosition; + Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(direction.x, direction.z), 0.0f); + transform.LocalRotation = targetRotation; + + } + ai.attackHitbox.SetActive(false); } @@ -64,18 +75,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States rotate.lookAround = false; } - Transform transform = machine.GetComponent(); - AILineOfSight los = machine.GetScript(); - Transform playerTransform = ai.player.GetComponent(); - - - if(los && transform) - { - Vector3 direction = playerTransform.GlobalPosition - transform.GlobalPosition; - Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(direction.x, direction.z), 0.0f); - transform.LocalRotation = targetRotation; - - } + ai.attackHitbox.SetActive(false); } @@ -106,11 +106,17 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States } else if(seq) { + + if(timer <= 1.0f / 30.0f) + { + ai.attackHitbox.SetActive(true); + } + if(timer <= 0.0f) { seq = false; end = true; - animator.PlayOneShot(ai.atkSeqAnim); + timer = endTime;