void OnTriggerEnter2D(Collider2D collider) { if (collider.name == "Player") { music.fadeSourceOut(0.0001f); sound.playSound("pick"); dogObject.GetComponent <SpriteRenderer>().enabled = false; dogObject.GetComponent <BoxCollider2D>().enabled = false; StartCoroutine(transitionToEnd()); } }
void Update() { if (title.activeInHierarchy && inScene == false && delay == true) { StartCoroutine(startPlay()); } if (Input.GetKey("z") && inputs < 1) { music.fadeSourceOut(0.0001f); inputs += 1; sound.playSound("start"); PlayerPrefs.SetInt("score", 0); PlayerPrefs.SetInt("hp", 8); StartCoroutine(fadeOut()); } }
public IEnumerator fadeOutScreen() { music.fadeSourceOut(0.0001f); blackScreen.CrossFadeAlpha(1, 1, false); yield return(new WaitForSeconds(1.0f)); }