diff --git a/Assets/Audio/Master.bank b/Assets/Audio/Master.bank index 4447377d..cdd45b1b 100644 Binary files a/Assets/Audio/Master.bank and b/Assets/Audio/Master.bank differ diff --git a/Assets/Audio/Master.strings.bank b/Assets/Audio/Master.strings.bank index c69a30db..4611791f 100644 Binary files a/Assets/Audio/Master.strings.bank and b/Assets/Audio/Master.strings.bank differ diff --git a/Assets/Audio/Music.bank b/Assets/Audio/Music.bank index 2e05bb9b..83e4f2db 100644 Binary files a/Assets/Audio/Music.bank and b/Assets/Audio/Music.bank differ diff --git a/Assets/Audio/SFX.bank b/Assets/Audio/SFX.bank index bb26b8ef..01b66d75 100644 Binary files a/Assets/Audio/SFX.bank and b/Assets/Audio/SFX.bank differ diff --git a/Assets/Scenes/Level1.shade b/Assets/Scenes/Level1.shade index 019b946d..dfc6103f 100644 --- a/Assets/Scenes/Level1.shade +++ b/Assets/Scenes/Level1.shade @@ -9256,7 +9256,7 @@ Enabled: true player: 65775 range: 5 - angle: 30 + angle: 45 angleBetween: 0 distance: 0 heightLimit: 1 @@ -9298,7 +9298,7 @@ - EID: 627 Name: AttackHitbox IsActive: true - NumberOfChildren: 0 + NumberOfChildren: 1 Components: Transform Component: Translate: {x: 0, y: -0.10252738, z: -2.20271254} @@ -9322,6 +9322,17 @@ Enabled: true aiGO: 65771 raccoonFound: false +- EID: 609 + Name: NetPosition + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: 0, y: 0, z: -0.329473495} + Rotate: {x: -0, y: 0, z: -0} + Scale: {x: 1, y: 1, z: 1} + IsActive: true + Scripts: ~ - EID: 131271 Name: Gameplay Canvas IsActive: true diff --git a/Assets/Scenes/Level2.shade b/Assets/Scenes/Level2.shade index 376d3b66..35e03163 100644 --- a/Assets/Scenes/Level2.shade +++ b/Assets/Scenes/Level2.shade @@ -3886,6 +3886,7 @@ Score: 0 timer: 200 scoreText: 237 + scoreTextBG: 568 timeText: 131278 minusTimerText: 131211 Results: 624 @@ -6073,7 +6074,7 @@ Enabled: true player: 2 range: 5 - angle: 30 + angle: 45 angleBetween: 0 distance: 0 heightLimit: 1 @@ -17338,7 +17339,12 @@ Hovered: false Clicked: false IsActive: true - Scripts: ~ + Scripts: + - Type: SHADE_Scripting.UI.SingleScaleBounce + Enabled: true + durationUp: 0.150000006 + durationDown: 0.300000012 + scaleSize: 1.20000005 - EID: 66150 Name: ParticlesDeco IsActive: true @@ -17450,11 +17456,11 @@ - EID: 627 Name: AttackHitbox IsActive: true - NumberOfChildren: 0 + NumberOfChildren: 1 Components: Transform Component: - Translate: {x: 0, y: -0.10252738, z: -2.20271254} - Rotate: {x: 0, y: 0, z: 0} + Translate: {x: 0, y: -0.10252738, z: -2.20000005} + Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true Collider Component: @@ -17474,6 +17480,17 @@ Enabled: true aiGO: 158 raccoonFound: false +- EID: 609 + Name: NetPosition + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: 0, y: 0, z: -0.329473495} + Rotate: {x: -0, y: 0, z: -0} + Scale: {x: 1, y: 1, z: 1} + IsActive: true + Scripts: ~ - EID: 624 Name: Result Canvas IsActive: false diff --git a/Assets/Scenes/Level3.shade b/Assets/Scenes/Level3.shade index a65d0a77..b74cca52 100644 --- a/Assets/Scenes/Level3.shade +++ b/Assets/Scenes/Level3.shade @@ -15560,7 +15560,7 @@ Enabled: true player: 65775 range: 5 - angle: 30 + angle: 45 angleBetween: 0 distance: 0 heightLimit: 1 @@ -15602,7 +15602,7 @@ - EID: 627 Name: AttackHitbox IsActive: true - NumberOfChildren: 0 + NumberOfChildren: 1 Components: Transform Component: Translate: {x: 0, y: -0.10252738, z: -2.20271254} @@ -15626,6 +15626,17 @@ Enabled: true aiGO: 66078 raccoonFound: false +- EID: 230 + Name: NetPosition + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: 0, y: 0, z: -0.329473495} + Rotate: {x: -0, y: 0, z: -0} + Scale: {x: 1, y: 1, z: 1} + IsActive: true + Scripts: ~ - EID: 66062 Name: Gameplay Canvas IsActive: true diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs index 095ef1a3..c72f4d09 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs @@ -32,6 +32,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework public AnimationClipAsset atkHoldAnim; public AnimationClipAsset atkSeqAnim; + + + private Vector3 startPos; public bool atk { get; set; } @@ -75,8 +78,12 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework } AudioHandler.audioClipHandlers["HO_footsteps"] = SHADE.Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps"); + SHADE.Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["HO_footsteps"], GameObject.EntityId); - patrolPointPool = patrolPointParent.GetComponentsInChildren(); + AudioHandler.audioClipHandlers["HO_bark"] = SHADE.Audio.CreateAudioClip("event:/Homeowner/homeowner_bark"); + SHADE.Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["HO_bark"], GameObject.EntityId); + + patrolPointPool = patrolPointParent.GetComponentsInChildren(); pppList = patrolPointPool.ToList(); transform = GetComponent(); diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AlertState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AlertState.cs index f3c9e436..fb1df231 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AlertState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AlertState.cs @@ -12,12 +12,12 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States { const float alertDuration = 16.0f / 30.0f + 1.0f; float alertTimer = alertDuration; - + bool firstDetection; public AlertState(StateMachine machine) : base(machine) { stateName = "Alert"; AudioHandler.audioClipHandlers["raccoondetected"] = SHADE.Audio.CreateAudioClip("event:/Raccoon/raccoon_detected"); - + firstDetection = true; } public override void OnEnter() @@ -28,9 +28,33 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States animator.PlayOneShot(ai.alertAnim); } - SHADE.Audio.SetParameterWithLabel("PlayerDetection", "Detected"); - AudioHandler.audioClipHandlers["raccoondetected"].Play(); - } + + if(firstDetection) + { + SHADE.Audio.SetParameterWithLabel("HomeownerBark", "DetectFirst"); + AudioHandler.audioClipHandlers["HO_bark"].Play(); + firstDetection = false; + } + else + { + + PlayerController pc = ai.player.GetScript(); + + if (pc && pc.holdItem) + { + SHADE.Audio.SetParameterWithLabel("HomeownerBark", "DetectFood"); + AudioHandler.audioClipHandlers["HO_bark"].Play(); + } + else + { + SHADE.Audio.SetParameterWithLabel("HomeownerBark", "DetectAgain"); + AudioHandler.audioClipHandlers["HO_bark"].Play(); + } + + } + + + } public override void OnExit() { animator.Stop(); diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs index b57ad2a6..a826c170 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs @@ -23,6 +23,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States bool seq = false; bool end = false; + bool raccoonCaught = true; + public AttackState(StateMachine machine) : base(machine) { @@ -40,6 +42,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States end = false; timer = windupTime; + raccoonCaught = false; + RotateToVelocity rotate = machine.GetScript(); if (rotate) rotate.active = false; @@ -86,11 +90,18 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States { if (ai.hitboxScript.raccoonFound) { - machine.SetState(typeof(CaughtRaccoonState)); - } + raccoonCaught = true; + Transform pcTransform = ai.player.GetComponent(); + Transform netTransform = ai.attackHitbox.GetComponentInChildren(); + if (pcTransform && netTransform) + { + pcTransform.GlobalPosition = netTransform.GlobalPosition; + } + + } - timer -= Time.DeltaTimeF; + timer -= Time.DeltaTimeF; if (windUp) { if (timer <= 0.0f) @@ -137,15 +148,24 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States if (timer <= 0.0f) { end = false; - AILineOfSight los = ai.GetScript(); - if (los && los.withinSight) + + if(raccoonCaught) { - machine.SetState(typeof(ChaseState)); + machine.SetState(typeof(CaughtRaccoonState)); } else { - machine.SetState(typeof(TimeoutState)); - } + AILineOfSight los = ai.GetScript(); + if (los && los.withinSight) + { + machine.SetState(typeof(ChaseState)); + } + else + { + machine.SetState(typeof(TimeoutState)); + } + } + } diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/CaughtRaccoonState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/CaughtRaccoonState.cs index 0381b0bd..ca557dc1 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/CaughtRaccoonState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/CaughtRaccoonState.cs @@ -25,6 +25,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States pc = ai.hitboxScript.pc; timer = ai.caughtDuration; + if (pc) + pc.Caught(); } @@ -40,14 +42,22 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States { if (pc) { - pc.currentState = RaccoonStates.CAUGHT; - if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState))) - pc.stateMachine.SetState(typeof(PlayerCaughtState)); - - pc.GotCaught(); + + pc.Reset(); } ai.Reset(); } + else + { + Transform pcTransform = pc.GetComponent(); + Transform netTransform = ai.attackHitbox.GetComponentInChildren(); + if (pcTransform && netTransform) + { + pcTransform.GlobalPosition = netTransform.GlobalPosition; + } + + + } } diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/ChaseState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/ChaseState.cs index c2a32c81..3a951562 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/ChaseState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/ChaseState.cs @@ -22,10 +22,16 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States float footStepInterval = 12.0f / 30.0f; float footStepTimer = 0.0f; + float barkTimer = 0.0f; + + Random rand; + + public ChaseState(StateMachine machine): base(machine) { stateName = "Chase"; + rand = new Random(); } public override void OnEnter() @@ -42,6 +48,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States footStepTimer = footStepInterval * 0.5f; + + + barkTimer = (float)rand.Next(0, 2) + (float)rand.NextDouble(); } public override void OnExit() @@ -57,11 +66,25 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States { rotate.lookAround = false; } + + + } public override void update() { - Navigation nav = machine.GetComponent(); + barkTimer -= Time.DeltaTimeF; + if(barkTimer <= 0.0f) + { + barkTimer = (float)rand.Next(4, 6) + (float)rand.NextDouble(); + + SHADE.Audio.SetParameterWithLabel("HomeownerBark", "Chase"); + AudioHandler.audioClipHandlers["HO_bark"].Play(); + } + + + + Navigation nav = machine.GetComponent(); AILineOfSight los = ai.GetScript(); RigidBody rigid = machine.GetComponent(); if (los && nav) diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/TimeoutState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/TimeoutState.cs index a896af78..ebb7b672 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/TimeoutState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/TimeoutState.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using SHADE; +using SHADE_Scripting.Audio; namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States { @@ -23,7 +24,10 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States timer = 0.0f; animator.Play(ai.idleAnim); - } + SHADE.Audio.SetParameterWithLabel("HomeownerBark", "DetectLost"); + AudioHandler.audioClipHandlers["HO_bark"].Play(); + + } public override void update() { diff --git a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs index 7235ef8b..6276b96d 100644 --- a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs +++ b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs @@ -22,7 +22,9 @@ public class PlayerController : Script public Transform tranform { get; set; } public Camera cam { get; set; } public CameraArm camArm { get; set; } - private PickAndThrow pat; + + [NonSerialized] + public PickAndThrow pat; public StateMachine stateMachine { get; set; } public ParticleEmitter Leftsmoke { get; set; } public ParticleEmitter Rightsmoke { get; set; } @@ -227,7 +229,7 @@ public class PlayerController : Script } } - GotCaught(); + Rotation(); MoveKey(); Sprint(); @@ -254,6 +256,10 @@ public class PlayerController : Script private void MoveKey() { + + if (currentState == RaccoonStates.CAUGHT) + return; + axisMove = Vector2.Zero; if (Input.GetKey(Input.KeyCode.W)) { @@ -290,7 +296,7 @@ public class PlayerController : Script axisMove.Normalise(); isMoveKeyPress = axisMove.x != 0 || axisMove.y != 0; - if (isMoveKeyPress && isGrounded && !Input.GetKey(Input.KeyCode.LeftShift)) + if (isMoveKeyPress && isGrounded && !Input.GetKey(Input.KeyCode.LeftShift) && currentState != RaccoonStates.CAUGHT) { currentState = RaccoonStates.WALKING; @@ -334,6 +340,9 @@ public class PlayerController : Script private void Sprint() { + if (currentState == RaccoonStates.CAUGHT) + return; + if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded) { currentState = RaccoonStates.RUNNING; @@ -505,41 +514,10 @@ public class PlayerController : Script } } - public void GotCaught() - { - if (currentState == RaccoonStates.CAUGHT && tranform && respawnPoint) - { - AudioHandler.audioClipHandlers["RaccoonCaught"].Play(); - currentState = RaccoonStates.IDLE; - if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState))) - stateMachine.SetState(typeof(PlayerIdleState)); - - tranform.GlobalPosition = respawnPoint.GetComponent().GlobalPosition; - - GameManager.Instance.RacoonCaught(); - - if (pat && pat.item) - { - if (holdItem) - { - holdItem = false; - pat.item.GetScript().returnBack = true; - pat.SetItemGravityBack(); - pat.ResetItemObject(); - } - if (isAiming) - { - isAiming = false; - cam.FOV = Settings.cameraFOV; - camArm.TargetOffset = pat.prevTargetOffSet; - camArm.ArmLength = pat.tpc.armLength; - } - } - } - } public void Caught() { + //Debug.Log("PlayerController: Raccoon Caught"); currentState = RaccoonStates.CAUGHT; if (stateMachine && !stateMachine.IsState(typeof(PlayerCaughtState))) stateMachine.SetState(typeof(PlayerCaughtState)); @@ -566,9 +544,12 @@ public class PlayerController : Script public void Reset() { + //Debug.Log("PlayerController: Raccon Reset " + currentState); + if (currentState == RaccoonStates.CAUGHT && tranform && respawnPoint) { - currentState = RaccoonStates.IDLE; + //Debug.Log("PlayerController: Raccon Reset inside if " + currentState); + currentState = RaccoonStates.IDLE; if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState))) stateMachine.SetState(typeof(PlayerIdleState)); diff --git a/Assets/Scripts/Gameplay/SC_GameManager.cs b/Assets/Scripts/Gameplay/SC_GameManager.cs index 59a56106..669d0cd3 100644 --- a/Assets/Scripts/Gameplay/SC_GameManager.cs +++ b/Assets/Scripts/Gameplay/SC_GameManager.cs @@ -25,6 +25,7 @@ public class GameManager : Script public float timer; public GameObject scoreText; + public GameObject scoreTextBG; public GameObject timeText; public GameObject minusTimerText; @@ -234,17 +235,25 @@ public class GameManager : Script AudioHandler.audioClipHandlers["SFXItemScore"].Play(); AudioHandler.audioClipHandlers["RaccoonScored"].Play(); - MultiplierTextFx fx = multiplierText.GetScript(); + SingleScaleBounce textBounce = scoreText.GetScript(); + SingleScaleBounce textBGBounce = scoreTextBG.GetScript(); + + + + + //if (textBounce) + // textBounce.ScaleBounceOnce(); + + if (textBGBounce) + textBGBounce.ScaleBounceOnce(); + + + MultiplierTextFx fx = multiplierText.GetScript(); if (fx) { fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration); } - SingleScaleBounce sb = scoreText.GetScript(); - if(sb) - { - sb.ScaleBounceOnce(); - } } diff --git a/Assets/Scripts/UI/SC_SingleScaleBounce.cs b/Assets/Scripts/UI/SC_SingleScaleBounce.cs index b0833de6..27997844 100644 --- a/Assets/Scripts/UI/SC_SingleScaleBounce.cs +++ b/Assets/Scripts/UI/SC_SingleScaleBounce.cs @@ -37,7 +37,7 @@ namespace SHADE_Scripting.UI protected override void start() { - if(thread != null) + thread = TweenManager.CreateTweenThread(0.0f, 1.0f, 1.0f, EASING_METHOD.EASE_IN_SINE); } @@ -66,6 +66,10 @@ namespace SHADE_Scripting.UI thread.duration = durationUp; thread.Reset(1.0f, scaleSize); } + else + { + Debug.Log("Single Scale Bounce: thread is null"); + } }