Removed a coin bug

This commit is contained in:
MarcUs7 2024-12-29 16:23:26 +01:00
parent a1a563a7fa
commit aa6085b151
2 changed files with 9 additions and 2 deletions

View file

@ -26,7 +26,7 @@ public class SC_2DCoin : MonoBehaviour
TotalCoins++;
c2d.GetComponent<PlayerMovement>().PlayCoinSound();
PlayerMovement.ShouldPlayCoinSound = true;
Destroy(gameObject);
// Start the cooldown coroutine

View file

@ -24,6 +24,7 @@ public class PlayerMovement : MonoBehaviour
private static readonly int IsCrouching = Animator.StringToHash("IsCrouching");
public static InputActions InputActions;
public static bool ShouldPlayCoinSound;
private void Awake()
{
@ -95,6 +96,12 @@ public class PlayerMovement : MonoBehaviour
{
animator.SetBool(IsJumping, true);
}
if (ShouldPlayCoinSound)
{
ShouldPlayCoinSound = false;
PlayCoinSound();
}
}
public void OnLanding()