void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") { if (this.entrance == true) { for (int i = 0; i < 10; i++) { int ran = Random.Range(0, 100); if (ran >= 0 && ran < pseudo) { hole[i].desti = 1; } else { hole[i].desti = 0; } } h = Random.Range(0, 9); if (h >= 0 && h < 5) { leftorright = 0; holw2 = h + 1; } else { leftorright = 1; holw2 = h - 5 + 1; } hole[h].desti = 2; } else { FadeZero f = FindObjectOfType <FadeZero>(); f.startnewFade(); f.fadeOut(); if (this.desti == 0) { ent.pseudo = 100; } if (this.desti == 1) { ent.pseudo = 25; } float x = destination[desti].GetComponent <Transform>().position.x; float y = destination[desti].GetComponent <Transform>().position.y; float z = destination[desti].GetComponent <Transform>().position.z; other.gameObject.GetComponent <Transform>().position = new Vector3(x, y, z); StartCoroutine(delay()); } } }
void checkDie() { if (this.HP <= 0) { FadeZero fz = FindObjectOfType <FadeZero>(); if (dead == false) { dead = true; fz.startnewFade(); } moveScript.changeState(13); fz.fadeOut(); if (fz.fadeFinish == true) { die(); } } }