fixed ui
also added the general game ui canvas to all scenes
This commit is contained in:
		@@ -26,6 +26,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
    [Header("Controllers:")]
 | 
			
		||||
    [SerializeField] private PlayerMovement playerController;
 | 
			
		||||
    [SerializeField] private StateController stateController;
 | 
			
		||||
    private GameUIController gameUI;
 | 
			
		||||
 | 
			
		||||
    Animator animator;
 | 
			
		||||
    [HideInInspector] public bool playerIsAlive = true;
 | 
			
		||||
@@ -40,6 +41,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
    {  // initialize
 | 
			
		||||
        _rb = GetComponent<Rigidbody2D>();
 | 
			
		||||
        stateController = GameObject.Find("StateController").GetComponent<StateController>();
 | 
			
		||||
        gameUI = GameObject.FindGameObjectWithTag("GameUICanvas").GetComponent<GameUIController>();
 | 
			
		||||
 | 
			
		||||
        audioSource = this.gameObject.GetComponent<AudioSource>();
 | 
			
		||||
        audioSource.clip = footstepSound;
 | 
			
		||||
@@ -125,10 +127,15 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
        if (unlockedTambourine && hasTambourine && !grapplingRope.isGrappling)
 | 
			
		||||
            {
 | 
			
		||||
                launcher.ThrowTambourine(forward);
 | 
			
		||||
                hasTambourine = false;
 | 
			
		||||
                SetHasTambourine(false);
 | 
			
		||||
            }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void SetHasTambourine(bool state) {
 | 
			
		||||
        hasTambourine = state;
 | 
			
		||||
        gameUI.ToggleTambourine(state);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void AttemptGrapple() {
 | 
			
		||||
        if (tambourine != null)
 | 
			
		||||
        { // grapple to tambourine
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ public class TambourineBehavior : MonoBehaviour {
 | 
			
		||||
            timeLerped += Time.deltaTime;
 | 
			
		||||
            this.gameObject.transform.position = Vector2.Lerp(this.gameObject.transform.position, player.transform.position, timeLerped/0.1f);
 | 
			
		||||
            if (this.gameObject.transform.position.x == player.transform.position.x && this.gameObject.transform.position.y == player.transform.position.y) {
 | 
			
		||||
                player.GetComponent<PlayerBehavior>().hasTambourine = true;
 | 
			
		||||
                player.GetComponent<PlayerBehavior>().SetHasTambourine(true);
 | 
			
		||||
                Destroy(this.gameObject);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user