diff --git a/Assets/Scripts/Gameplay/Player/SC_PickAndThrow.cs b/Assets/Scripts/Gameplay/Player/SC_PickAndThrow.cs index 7342a126..bffb54d6 100644 --- a/Assets/Scripts/Gameplay/Player/SC_PickAndThrow.cs +++ b/Assets/Scripts/Gameplay/Player/SC_PickAndThrow.cs @@ -26,7 +26,7 @@ public class PickAndThrow : Script protected override void awake() { playerTran = GetComponent(); - if (playerTran) + if (!playerTran) Debug.Log("PLAYERTRANSFORM EMPTY"); ; pc = GetScript(); @@ -34,7 +34,7 @@ public class PickAndThrow : Script Debug.Log("PLAYER CONTROLLER EMPTY"); raccoonHoldLocation = GetComponentInChildren(); - if (raccoonHoldLocation == null) + if (!raccoonHoldLocation) Debug.Log("CHILD EMPTY"); tpc = GetScriptInChildren(); @@ -66,6 +66,7 @@ public class PickAndThrow : Script if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming) { + Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_throw"); pc.isAiming = false; if(tpc) pc.camArm.ArmLength = tpc.armLength; @@ -94,7 +95,6 @@ public class PickAndThrow : Script { if (pc.currentState == RaccoonStates.WALKING || pc.currentState == RaccoonStates.IDLE) { - Debug.Log("PCIKUP"); pc.holdItem = true; RetrieveItemComponets(); } diff --git a/Assets/Scripts/Gameplay/Player/UT_PlayerCaughtState .cs.shmeta b/Assets/Scripts/Gameplay/Player/UT_PlayerCaughtState .cs.shmeta index afe53e39..3bfb8b79 100644 --- a/Assets/Scripts/Gameplay/Player/UT_PlayerCaughtState .cs.shmeta +++ b/Assets/Scripts/Gameplay/Player/UT_PlayerCaughtState .cs.shmeta @@ -1,3 +1,3 @@ Name: UT_PlayerCaughtState -ID: 153166405 +ID: 154071709 Type: 9 diff --git a/Assets/Scripts/Gameplay/Player/UT_PlayerRunState.cs b/Assets/Scripts/Gameplay/Player/UT_PlayerRunState.cs index aae467b3..f7a30e1d 100644 --- a/Assets/Scripts/Gameplay/Player/UT_PlayerRunState.cs +++ b/Assets/Scripts/Gameplay/Player/UT_PlayerRunState.cs @@ -3,9 +3,12 @@ using System; public class PlayerRunState : BaseState { + private float timer; + private float delay = 0.25f; + public PlayerRunState(StateMachine stateMachine) : base(stateMachine) { - stateName = "Walk State"; + stateName = "Run State"; } public override void OnEnter() { @@ -14,6 +17,13 @@ public class PlayerRunState : BaseState public override void update() { //Debug.Log("WALKING"); + timer += Time.DeltaTimeF; + + if (timer > delay) + { + Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_footsteps"); + timer = 0; + } } public override void fixedUpdate() { diff --git a/Assets/Scripts/Gameplay/Player/UT_PlayerWalkState.cs b/Assets/Scripts/Gameplay/Player/UT_PlayerWalkState.cs index d299381c..471da145 100644 --- a/Assets/Scripts/Gameplay/Player/UT_PlayerWalkState.cs +++ b/Assets/Scripts/Gameplay/Player/UT_PlayerWalkState.cs @@ -3,6 +3,8 @@ using System; public class PlayerWalkState : BaseState { + private float timer; + private float delay = 0.5f; public PlayerWalkState(StateMachine stateMachine) : base(stateMachine) { stateName = "Walk State"; @@ -10,10 +12,18 @@ public class PlayerWalkState : BaseState public override void OnEnter() { //Debug.Log("WALK ENTER"); + timer = delay; } public override void update() { //Debug.Log("WALKING"); + timer += Time.DeltaTimeF; + + if (timer > delay) + { + Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_footsteps"); + timer = 0; + } } public override void fixedUpdate() { diff --git a/Assets/Scripts/Gameplay/SC_Item.cs b/Assets/Scripts/Gameplay/SC_Item.cs index 56ee0d0e..2cdda06c 100644 --- a/Assets/Scripts/Gameplay/SC_Item.cs +++ b/Assets/Scripts/Gameplay/SC_Item.cs @@ -14,6 +14,7 @@ public class Item : Script public ItemCategory currCategory; private RigidBody rb; private Collider collider; + private bool once = false; protected override void awake() { @@ -31,8 +32,21 @@ public class Item : Script } } - protected override void onTriggerEnter(CollisionInfo info) + protected override void onCollisionEnter(CollisionInfo info) { + if (once) + { + if(currCategory == ItemCategory.LIGHT) + Audio.PlayBGMOnce2D("event:/Props/impact_elastic"); + else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY) + Audio.PlayBGMOnce2D("event:/Props/impact_hard"); + once = false; + } + } + + protected override void onCollisionExit(CollisionInfo info) + { + once = true; } } \ No newline at end of file diff --git a/Assets/Scripts/Gameplay/SC_ScoringZone.cs b/Assets/Scripts/Gameplay/SC_ScoringZone.cs index 849f3e1c..dec02c37 100644 --- a/Assets/Scripts/Gameplay/SC_ScoringZone.cs +++ b/Assets/Scripts/Gameplay/SC_ScoringZone.cs @@ -12,6 +12,7 @@ public class ScoringZone : Script { if (gameManger && info.GameObject.GetScript()) { + Audio.PlayBGMOnce2D("event:/Music/stingers/item_scored"); gameManger.Score += info.GameObject.GetScript().Score; gameManger.totalItemCount -= 1; info.GameObject.SetActive(false); diff --git a/Assets/Scripts/SC_SoundsBoard.cs b/Assets/Scripts/SC_SoundsBoard.cs index e1f89855..839450a9 100644 --- a/Assets/Scripts/SC_SoundsBoard.cs +++ b/Assets/Scripts/SC_SoundsBoard.cs @@ -34,39 +34,39 @@ event:/Homeowner/homeowner_detect_raccoon } protected override void update() { - if (Input.GetKey(Input.KeyCode.Q)) + if (Input.GetKeyDown(Input.KeyCode.Q)) Audio.PlayBGMOnce2D("event:/UI/mouse_down_element"); - if (Input.GetKey(Input.KeyCode.W)) + if (Input.GetKeyDown(Input.KeyCode.W)) Audio.PlayBGMOnce2D("event:/UI/mouse_down_empty"); - if (Input.GetKey(Input.KeyCode.E)) + if (Input.GetKeyDown(Input.KeyCode.E)) Audio.PlayBGMOnce2D("event:/UI/mouse_enter_element"); - if (Input.GetKey(Input.KeyCode.R)) + if (Input.GetKeyDown(Input.KeyCode.R)) Audio.PlayBGMOnce2D("event:/UI/mouse_exit_element"); - if (Input.GetKey(Input.KeyCode.T)) + if (Input.GetKeyDown(Input.KeyCode.T)) Audio.PlayBGMOnce2D("event:/UI/success"); - if (Input.GetKey(Input.KeyCode.Y)) + if (Input.GetKeyDown(Input.KeyCode.Y)) Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_throw"); - if (Input.GetKey(Input.KeyCode.U)) + if (Input.GetKeyDown(Input.KeyCode.U)) Audio.PlayBGMOnce2D("event:/Props/impact_hard"); - if (Input.GetKey(Input.KeyCode.I)) + if (Input.GetKeyDown(Input.KeyCode.I)) Audio.PlayBGMOnce2D("event:/Music/player_undetected"); - if (Input.GetKey(Input.KeyCode.O)) + if (Input.GetKeyDown(Input.KeyCode.O)) Audio.PlayBGMOnce2D("event:/Music/player_detected"); - if (Input.GetKey(Input.KeyCode.P)) + if (Input.GetKeyDown(Input.KeyCode.P)) Audio.PlayBGMOnce2D("event:/Music/stingers/player_detected"); - if (Input.GetKey(Input.KeyCode.A)) + if (Input.GetKeyDown(Input.KeyCode.A)) Audio.PlayBGMOnce2D("event:/Music/stingers/item_scored"); - if (Input.GetKey(Input.KeyCode.S)) + if (Input.GetKeyDown(Input.KeyCode.S)) Audio.PlayBGMOnce2D("event:/Homeowner/homeowner_humming"); - if (Input.GetKey(Input.KeyCode.D)) + if (Input.GetKeyDown(Input.KeyCode.D)) Audio.PlayBGMOnce2D("event:/Homeowner/homeowner_footsteps"); - if (Input.GetKey(Input.KeyCode.F)) + if (Input.GetKeyDown(Input.KeyCode.F)) Audio.PlayBGMOnce2D("event:/Homeowner/homeowner_detect_raccoon"); - if (Input.GetKey(Input.KeyCode.G)) + if (Input.GetKeyDown(Input.KeyCode.G)) Audio.PlayBGMOnce2D("event:/Music/player_undetected"); - if (Input.GetKey(Input.KeyCode.H)) + if (Input.GetKeyDown(Input.KeyCode.H)) Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_footsteps"); - if (Input.GetKey(Input.KeyCode.J)) + if (Input.GetKeyDown(Input.KeyCode.J)) Audio.PlayBGMOnce2D("event:/Props/impact_elastic"); }