fixed cymbal bugs
sound no longer breaks (separate game object for sound), ui updated
This commit is contained in:
		@@ -59,12 +59,12 @@ public class GameUIController : MonoBehaviour
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void ToggleCymbal(bool desiredState)
 | 
			
		||||
    public void ToggleCymbal(bool toggleState)
 | 
			
		||||
    {
 | 
			
		||||
        bool curEnabled = clarinetUI.GetComponent<Image>().enabled;
 | 
			
		||||
        if (curEnabled != desiredState)
 | 
			
		||||
        bool curEnabled = cymbalUI.GetComponent<Image>().enabled;
 | 
			
		||||
        if (curEnabled != toggleState)
 | 
			
		||||
        {
 | 
			
		||||
            cymbalUI.GetComponent<Image>().enabled = desiredState;
 | 
			
		||||
            cymbalUI.GetComponent<Image>().enabled = toggleState;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    [Header("Cymbals:")]
 | 
			
		||||
    private float cymbalActiveTime = 0f;
 | 
			
		||||
    [SerializeField] AudioSource cymbalAudio;
 | 
			
		||||
 | 
			
		||||
    [Header("Grappling:")]
 | 
			
		||||
    [SerializeField] public Tutorial_GrapplingGun grapplingGun;
 | 
			
		||||
@@ -49,7 +50,6 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
    [Header("Sound")]
 | 
			
		||||
    [SerializeField] public AudioClip footstepSound;
 | 
			
		||||
    [SerializeField] public AudioClip deathSound;
 | 
			
		||||
    [SerializeField] public AudioClip cymbalSound;
 | 
			
		||||
    AudioSource audioSource;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -152,9 +152,10 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
            {
 | 
			
		||||
                // Play the sound
 | 
			
		||||
                this.gameUI.ToggleCymbal(false);
 | 
			
		||||
                this.audioSource.clip = cymbalSound;
 | 
			
		||||
                this.audioSource.loop = false;
 | 
			
		||||
                this.audioSource.Play();
 | 
			
		||||
                // this.audioSource.clip = cymbalSound;
 | 
			
		||||
                // this.audioSource.loop = false;
 | 
			
		||||
                // this.audioSource.Play();
 | 
			
		||||
                cymbalAudio.Play();
 | 
			
		||||
 | 
			
		||||
                // Set the cymbal active for the equivalent of one second
 | 
			
		||||
                this.cymbalActiveTime = 1;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user