diff --git a/Assets/Audio/Music.bank b/Assets/Audio/Music.bank index 30d594ca..2e05bb9b 100644 Binary files a/Assets/Audio/Music.bank and b/Assets/Audio/Music.bank differ diff --git a/Assets/Scenes/Level1.shade b/Assets/Scenes/Level1.shade index 0048acb5..5c2478d7 100644 --- a/Assets/Scenes/Level1.shade +++ b/Assets/Scenes/Level1.shade @@ -9354,7 +9354,7 @@ - Is Trigger: true Collision Tag: 5 Type: Box - Half Extents: {x: 0.600000024, y: 1.79999995, z: 1.5} + Half Extents: {x: 1, y: 1.79999995, z: 1.5} Friction: 0.400000006 Bounciness: 0 Density: 1 diff --git a/Assets/Scenes/Level2.shade b/Assets/Scenes/Level2.shade index f53cd8cd..40af1ff0 100644 --- a/Assets/Scenes/Level2.shade +++ b/Assets/Scenes/Level2.shade @@ -17145,7 +17145,7 @@ - Is Trigger: true Collision Tag: 5 Type: Box - Half Extents: {x: 0.600000024, y: 1.79999995, z: 1.5} + Half Extents: {x: 1, y: 1.79999995, z: 1.5} Friction: 0.400000006 Bounciness: 0 Density: 1 diff --git a/Assets/Scenes/Level3.shade b/Assets/Scenes/Level3.shade index 240f7e34..8d04a37e 100644 --- a/Assets/Scenes/Level3.shade +++ b/Assets/Scenes/Level3.shade @@ -6,7 +6,7 @@ Components: Transform Component: Translate: {x: -4.64838362, y: 2.94342947, z: 0.209690213} - Rotate: {x: 0.5, y: 0.5, z: 6.5} + Rotate: {x: -1.48352981, y: 0.5, z: 6.5} Scale: {x: 1, y: 1, z: 1} IsActive: true Light Component: @@ -8951,7 +8951,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 0.806008875, y: 0, z: 1.30613756} + Translate: {x: 4.1322155, y: 0, z: 1.85982013} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -8962,7 +8962,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 0.513795853, y: 0, z: 5.17213631} + Translate: {x: 3.66769528, y: 0, z: 5.17213631} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -8973,7 +8973,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: -0.497500449, y: 0, z: 7.26010561} + Translate: {x: 5.12931681, y: 0, z: 7.53852272} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -8984,7 +8984,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: -0.380023897, y: 0, z: 9.58513737} + Translate: {x: 5.37614918, y: 0, z: 9.58513737} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -8995,7 +8995,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 4.76827145, y: 0, z: 9.12785816} + Translate: {x: -0.473824114, y: 0, z: 9.12785816} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -9006,7 +9006,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 5.0583787, y: 0, z: 4.71819115} + Translate: {x: -0.366229892, y: 0, z: 4.99889755} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -9017,7 +9017,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 3.53010821, y: 0, z: 4.63929033} + Translate: {x: 0.666945934, y: 0, z: 4.45493603} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -9028,7 +9028,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 3.64600039, y: 0, z: 2.86434269} + Translate: {x: 0.605797768, y: 0, z: 2.86434269} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -9039,7 +9039,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 3.50184393, y: 0, z: 0.390250444} + Translate: {x: 0.566371024, y: 0, z: 1.71020806} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -15112,7 +15112,7 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 0.667429447, y: 0, z: 1.10868871} + Translate: {x: 3.96016145, y: 0, z: 1.54417288} Rotate: {x: -0, y: 0, z: -0} Scale: {x: 1, y: 1, z: 1} IsActive: true @@ -15217,7 +15217,7 @@ - Is Trigger: true Collision Tag: 5 Type: Box - Half Extents: {x: 0.800000012, y: 1.79999995, z: 1.5} + Half Extents: {x: 1, y: 1.79999995, z: 1.5} 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 d522189c..828ba181 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAI.cs @@ -6,145 +6,148 @@ using SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States; namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework { - public class HomeOwnerAI:Script + public class HomeOwnerAI : Script + { + public float idleDuration = 1.0f; + public float timeoutDuration = 2.0f; + public GameObject patrolPointParent; + + public float patrolSpeed = 2.0f; + public float chaseSpeed = 3.0f; + + public float alertCooldown = 0.0f; + + public GameObject player; + public GameObject attackHitbox; + + public AnimationClipAsset walkingAnim; + public AnimationClipAsset idleAnim; + public AnimationClipAsset alertAnim; + public AnimationClipAsset alertRunAnim; + public AnimationClipAsset alertIdleAnim; + public AnimationClipAsset timeoutAnim; + public AnimationClipAsset atkWindupAnim; + public AnimationClipAsset atkHoldAnim; + public AnimationClipAsset atkSeqAnim; + + private Vector3 startPos; + public bool atk { get; set; } + + [NonSerialized] + public IEnumerable patrolPointPool; + + public void Reset() { - public float idleDuration = 1.0f; - public float timeoutDuration = 2.0f; - public GameObject patrolPointParent; - - public float patrolSpeed = 2.0f; - public float chaseSpeed = 3.0f; - - public float alertCooldown = 0.0f; - - public GameObject player; - public GameObject attackHitbox; - - public AnimationClipAsset walkingAnim; - public AnimationClipAsset idleAnim; - public AnimationClipAsset alertAnim; - public AnimationClipAsset alertRunAnim; - public AnimationClipAsset alertIdleAnim; - public AnimationClipAsset timeoutAnim; - public AnimationClipAsset atkWindupAnim; - public AnimationClipAsset atkHoldAnim; - public AnimationClipAsset atkSeqAnim; - - private Vector3 startPos; - - [NonSerialized] - public IEnumerable patrolPointPool; - - public void Reset() - { - Transform transform = GetComponent(); - StateMachine machine = GetScript(); - if (transform && machine) - { - transform.GlobalPosition = startPos; - machine.SetState(typeof(IdleState)); - } - } + Transform transform = GetComponent(); + StateMachine machine = GetScript(); + if (transform && machine) + { + transform.GlobalPosition = startPos; + machine.SetState(typeof(IdleState)); + } + } - protected override void awake() - { - StateMachine machine = GetScript(); - if(machine) - { - Dictionary dictionary = new Dictionary(); - dictionary.Add(typeof(IdleState), new IdleState(machine)); - dictionary.Add(typeof(PatrolState), new PatrolState(machine)); - dictionary.Add(typeof(TimeoutState), new TimeoutState(machine)); - dictionary.Add(typeof(ChaseState), new ChaseState(machine)); - dictionary.Add(typeof(AlertState), new AlertState(machine)); - dictionary.Add(typeof(AttackState), new AttackState(machine)); + protected override void awake() + { + StateMachine machine = GetScript(); + if (machine) + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(typeof(IdleState), new IdleState(machine)); + dictionary.Add(typeof(PatrolState), new PatrolState(machine)); + dictionary.Add(typeof(TimeoutState), new TimeoutState(machine)); + dictionary.Add(typeof(ChaseState), new ChaseState(machine)); + dictionary.Add(typeof(AlertState), new AlertState(machine)); + dictionary.Add(typeof(AttackState), new AttackState(machine)); - machine.InitStateMachine(dictionary); - } + machine.InitStateMachine(dictionary); + } - AudioHandler.audioClipHandlers["HO_footsteps"] = SHADE.Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps"); + AudioHandler.audioClipHandlers["HO_footsteps"] = SHADE.Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps"); - patrolPointPool = patrolPointParent.GetComponentsInChildren(); - Transform transform = GetComponent(); - if (transform) - { - startPos = transform.GlobalPosition; - } - - } - - protected override void start() - { - attackHitbox.SetActive(false); - } - - - protected override void update() - { - if(alertCooldown > 0.0f) - { - alertCooldown -= Time.DeltaTimeF; - } - else - { - alertCooldown = 0.0f; - } - AICheat(); - } - - public bool ShouldTransitAlert() - { - AILineOfSight los = GetScript(); - if (los) - { - if (los.withinSight && alertCooldown <= 0.0f) - { - return true; - } - } - return false; - } - - public void RotateToPlayer() - { - - //Transform playerTransform = player.GetComponent(); - - ////Rotate to face player. - //Transform aiTransform = GetComponent(); - //if(playerTransform && aiTransform) - //{ - // Vector3 direction = playerTransform.GlobalPosition - aiTransform.GlobalPosition; - // Quaternion currentRotation = aiTransform.LocalRotation; - // Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(direction.x, direction.z), 0.0f); - // aiTransform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, 5.0f * (float)Time.FixedDeltaTime); - //} - - } - - private void AICheat() - { - StateMachine machine = GetScript(); - AILineOfSight los = GetScript(); - if(machine && los) - { - 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)); - } - - } - - } + patrolPointPool = patrolPointParent.GetComponentsInChildren(); + Transform transform = GetComponent(); + if (transform) + { + startPos = transform.GlobalPosition; + } + atk = false; } + + protected override void start() + { + //attackHitbox.SetActive(false); + } + + + protected override void update() + { + if (alertCooldown > 0.0f) + { + alertCooldown -= Time.DeltaTimeF; + } + else + { + alertCooldown = 0.0f; + } + AICheat(); + } + + public bool ShouldTransitAlert() + { + AILineOfSight los = GetScript(); + if (los) + { + if (los.withinSight && alertCooldown <= 0.0f) + { + return true; + } + } + return false; + } + + public void RotateToPlayer() + { + + //Transform playerTransform = player.GetComponent(); + + ////Rotate to face player. + //Transform aiTransform = GetComponent(); + //if(playerTransform && aiTransform) + //{ + // Vector3 direction = playerTransform.GlobalPosition - aiTransform.GlobalPosition; + // Quaternion currentRotation = aiTransform.LocalRotation; + // Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(direction.x, direction.z), 0.0f); + // aiTransform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, 5.0f * (float)Time.FixedDeltaTime); + //} + + } + + private void AICheat() + { + StateMachine machine = GetScript(); + AILineOfSight los = GetScript(); + if (machine && los) + { + 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 1c9ac802..30d99e57 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs @@ -13,14 +13,18 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework { public GameObject aiGO; - Transform transform; - Transform aiTransform; + private bool raccoonFound = false; + Transform transform; + Transform aiTransform; + private PlayerController pc; + private HomeOwnerAI ai; protected override void start() { - transform = GetComponent(); - aiTransform = aiGO.GetComponent(); + transform = GetComponent(); + aiTransform = aiGO.GetComponent(); + ai = aiGO.GetScript(); } protected override void update() @@ -30,29 +34,28 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 0.7f; transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles; - + + } + + if (raccoonFound && pc && ai) + { + pc.currentState = RaccoonStates.CAUGHT; + if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState))) + pc.stateMachine.SetState(typeof(PlayerCaughtState)); + + pc.GotCaught(); + ai.Reset(); + raccoonFound = false; } } protected override void onTriggerStay(CollisionInfo info) { - - PlayerController pc = info.GameObject.GetScript(); - HomeOwnerAI ai = aiGO.GetScript(); - if (pc) + pc = info.GameObject.GetScript(); + if (ai && ai.atk && pc) { - pc.currentState = RaccoonStates.CAUGHT; - if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState))) - pc.stateMachine.SetState(typeof(PlayerCaughtState)); - - pc.GotCaught(); - if (ai) - { - ai.Reset(); - GameObject.SetActive(false); - } - + raccoonFound = true; } } diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AlertState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AlertState.cs index 272b694d..f3c9e436 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AlertState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AlertState.cs @@ -4,52 +4,55 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using SHADE_Scripting.Audio; namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States { - public class AlertState: AIBaseState + public class AlertState : AIBaseState + { + const float alertDuration = 16.0f / 30.0f + 1.0f; + float alertTimer = alertDuration; + + public AlertState(StateMachine machine) : base(machine) { - const float alertDuration = 16.0f/30.0f + 1.0f; - float alertTimer = alertDuration; - - - public AlertState(StateMachine machine): base(machine) - { - stateName = "Alert"; - } - - public override void OnEnter() - { - alertTimer = alertDuration; - if(animator) - { - animator.PlayOneShot(ai.alertAnim); - - } - SHADE.Audio.SetParameterWithLabel("PlayerDetection", "Detected"); - } - public override void OnExit() - { - animator.Stop(); - } - - public override void update() - { - alertTimer -= Time.DeltaTimeF; - if (alertTimer <= 0.0f) - { - machine.SetState(typeof(ChaseState)); - } - - } - - - - - public override void fixedUpdate() - { - - } + stateName = "Alert"; + AudioHandler.audioClipHandlers["raccoondetected"] = SHADE.Audio.CreateAudioClip("event:/Raccoon/raccoon_detected"); } + + public override void OnEnter() + { + alertTimer = alertDuration; + if (animator) + { + animator.PlayOneShot(ai.alertAnim); + + } + SHADE.Audio.SetParameterWithLabel("PlayerDetection", "Detected"); + AudioHandler.audioClipHandlers["raccoondetected"].Play(); + } + public override void OnExit() + { + animator.Stop(); + } + + public override void update() + { + alertTimer -= Time.DeltaTimeF; + if (alertTimer <= 0.0f) + { + machine.SetState(typeof(ChaseState)); + } + + } + + + + + public override void fixedUpdate() + { + + } + + } } diff --git a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs index cd25ef9d..b444c2fb 100644 --- a/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs +++ b/Assets/Scripts/Gameplay/AIBehaviour/AIRework/States/AttackState.cs @@ -7,145 +7,149 @@ using System.Threading.Tasks; namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States { - public class AttackState: AIBaseState + public class AttackState : AIBaseState + { + + float timer = 0.0f; + + float windupTime = 8.0f / 30.0f; + float holdTime = 0.3f; + 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) { - float timer = 0.0f; - - float windupTime = 8.0f / 30.0f; - float holdTime = 0.3f; - float seqTime = 8.0f / 30.0f ; - float endTime = 0.5f; + } - bool windUp = false; - bool hold = false; - bool seq = false; - bool end = false; + public override void OnEnter() + { + timer = 0.0f; + animator.PlayOneShot(ai.atkWindupAnim); + windUp = true; + hold = false; + seq = false; + end = false; + timer = windupTime; - public AttackState(StateMachine machine): base(machine) - { + RotateToVelocity rotate = machine.GetScript(); + if (rotate) + rotate.active = false; - } + RigidBody rigid = machine.GetComponent(); + if (rigid) + { + rigid.LinearVelocity = Vector3.Zero; + } + Transform transform = machine.GetComponent(); + AILineOfSight los = machine.GetScript(); + Transform playerTransform = ai.player.GetComponent(); - public override void OnEnter() - { - timer = 0.0f; - animator.PlayOneShot(ai.atkWindupAnim); - windUp = true; - hold = false; - seq = false; - end = false; - timer = windupTime; + 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; - RotateToVelocity rotate = machine.GetScript(); - if (rotate) - rotate.active = false; + } - RigidBody rigid = machine.GetComponent(); - if(rigid) - { - 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); - - } - - public override void OnExit() - { - animator.Stop(); - RotateToVelocity rotate = ai.GetScript(); - if (rotate) - { - rotate.active = true; - rotate.lookAround = false; - } - - - ai.attackHitbox.SetActive(false); - - } - - public override void update() - { - timer -= Time.DeltaTimeF; - if(windUp) - { - if(timer <= 0.0f) - { - windUp = false; - hold = true; - animator.Play(ai.atkHoldAnim); - timer = holdTime; - ai.attackHitbox.SetActive(true); - } - } - else if(hold) - { - if(timer <= 0.0f) - { - hold = false; - seq = true; - animator.PlayOneShot(ai.atkSeqAnim); - timer = seqTime; - } - } - else if(seq) - { - - if(timer <= 1.0f / 30.0f) - { - ai.attackHitbox.SetActive(true); - } - - if(timer <= 0.0f) - { - seq = false; - end = true; - - timer = endTime; - - - } - } - else if(end) - { - if(timer <= 0.0f) - { - end = false; - AILineOfSight los = ai.GetScript(); - if (los && los.withinSight) - { - machine.SetState(typeof(ChaseState)); - } - else - { - machine.SetState(typeof(TimeoutState)); - } - } - } - - - } - - public override void fixedUpdate() - { - - } + //ai.attackHitbox.SetActive(false); } + + public override void OnExit() + { + animator.Stop(); + RotateToVelocity rotate = ai.GetScript(); + if (rotate) + { + rotate.active = true; + rotate.lookAround = false; + } + + + //ai.attackHitbox.SetActive(false); + machine.GetScript().atk = false; + + } + + public override void update() + { + timer -= Time.DeltaTimeF; + if (windUp) + { + if (timer <= 0.0f) + { + windUp = false; + hold = true; + animator.Play(ai.atkHoldAnim); + timer = holdTime; + //ai.attackHitbox.SetActive(true); + //machine.GetScript().atk = true; + } + } + else if (hold) + { + if (timer <= 0.0f) + { + hold = false; + seq = true; + animator.PlayOneShot(ai.atkSeqAnim); + timer = seqTime; + } + } + else if (seq) + { + + if (timer <= 1.0f / 30.0f) + { + //ai.attackHitbox.SetActive(true); + machine.GetScript().atk = true; + } + + if (timer <= 0.0f) + { + seq = false; + end = true; + + timer = endTime; + + + } + } + else if (end) + { + if (timer <= 0.0f) + { + end = false; + AILineOfSight los = ai.GetScript(); + if (los && los.withinSight) + { + machine.SetState(typeof(ChaseState)); + } + else + { + machine.SetState(typeof(TimeoutState)); + } + } + } + + + } + + public override void fixedUpdate() + { + + } + + } } diff --git a/Assets/Scripts/Gameplay/Item/SC_Item.cs b/Assets/Scripts/Gameplay/Item/SC_Item.cs index 86b605c0..10b04d6c 100644 --- a/Assets/Scripts/Gameplay/Item/SC_Item.cs +++ b/Assets/Scripts/Gameplay/Item/SC_Item.cs @@ -1,5 +1,6 @@ using SHADE; using SHADE_Scripting.Audio; +using SHADE_Scripting.Gameplay.AIBehaviour.AIRework; using System; public class Item : Script { @@ -155,7 +156,7 @@ public class Item : Script emitter.Emit(); } - if (info.GameObject.GetScript() && homeownerOnce) + if (info.GameObject.GetScript() && homeownerOnce) { homeownerOnce = false; returnBack = true; diff --git a/Assets/Scripts/Gameplay/SC_GameManager.cs b/Assets/Scripts/Gameplay/SC_GameManager.cs index 4a81a67d..b4e17d29 100644 --- a/Assets/Scripts/Gameplay/SC_GameManager.cs +++ b/Assets/Scripts/Gameplay/SC_GameManager.cs @@ -51,6 +51,8 @@ public class GameManager : Script private bool goingToWin; private bool goingToLose; + private bool playSpeedUp = false; + protected override void awake() { if (Instance != null && Instance != this) @@ -91,6 +93,7 @@ public class GameManager : Script AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored"); AudioHandler.audioClipHandlers["RaccoonScored"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_scored"); + Audio.SetParameterWithLabel("PlaybackSpeed", "Normal"); } protected override void start() @@ -123,6 +126,13 @@ public class GameManager : Script if (currGameState == GameState.START) { timer -= Time.DeltaTimeF; + + if (timer < 30.0f && !playSpeedUp) + { + Audio.SetParameterWithLabel("PlaybackSpeed", "ToTransition"); + playSpeedUp = true; + } + if(scoreText) scoreText.GetComponent().Text = $"{Score}"; if(timeText)