void Update() { if (close && !fadeOut) { if (Input.GetKeyDown(KeyCode.E) && soulsManager.getSouls() >= soulsRequired) { soulsManager.numSouls -= soulsRequired; fadeOut = true; } } //when fading out else if (fadeOut) { //update the alpha of the material's color material.color = new Color(material.color.r, material.color.g, material.color.b, material.color.a - fadePerSecond); //disable the tree colider treeColider.enabled = false; } //once the alpha is less than zero, activate the new zone and disable the script. if (material.color.a <= 0) { if (LeadsToZone <= 0) { print("not set. bad"); } a.ActivateNewZone(LeadsToZone); GetComponentInChildren <UIPlayerUnlockCollision>().Disable(); GetComponentInChildren <UIPlayerUnlockCollision>().enabled = false; enabled = false; } }
private void Update() { if (t_playerSouls == null || t_playerHealth == null) { return; } t_playerHealth.text = Convert.ToString(health); t_playerSouls.text = Convert.ToString(soulsManager.getSouls()); }
void Update() { float dist = Vector3.Distance(player.transform.position, transform.position); // Debug.Log(dist); if (dist < distance) { if (Input.GetKeyDown(KeyCode.E) && soulsManager.getSouls() >= soulsRequired) { transform.RotateAround(pivot, Vector3.up, movementAngle); soulsManager.numSouls -= soulsRequired; if (LeadsToZone <= 0) { print("not set. bad"); } a.ActivateNewZone(LeadsToZone); GetComponentInChildren <UIPlayerUnlockCollision>().Disable(); enabled = false; } } }