private void ShowMenu(bool b) { if (PauseMenuObject.activeSelf == b) { return; } // Debug.Log(b); PauseMenuObject.SetActive(b); playerObject = GameObject.FindGameObjectWithTag("DynomiteDude"); playerScript = playerObject.GetComponent <DynamiteThrower>(); heliObject = GameObject.FindGameObjectWithTag("Player"); heliScript = heliObject.GetComponent <PlayerMovement>(); playerScript.disableThrow = b; heliScript.disableStuff = b; Time.timeScale = b ? 0f : 1f; }
// Update is called once per frame void Update() { //textMeshPro = gameObject.GetComponent<TextMeshProUGUI>(); if (playerScript == null) { playerScript = GameObject.FindGameObjectWithTag("DynomiteDude").GetComponent <DynamiteThrower>(); } if (heliScript == null) { heliScript = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterController2D>(); } currentDynomiteCount = playerScript.currentDynomiteCount; dynodudeAlive = playerScript.dudeIsAlive; heliHealth = heliScript.currentHealth; test.text = string.Format("dynoMITE: {0}\nthe_guy is alive: {1}\nhelicopter health: {2}", currentDynomiteCount, dynodudeAlive, heliHealth); }