private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { int random = Random.Range(0, 12); if (random == 1 || random == 2) { Instantiate(Pila, PlaceMidle.transform.position, Quaternion.identity); } if (random == 3) { Instantiate(Pila, PlaceLeft.transform.position, Quaternion.identity); Instantiate(Pila, PlaceMidle.transform.position, Quaternion.identity); Instantiate(Pila, PlaceRight.transform.position, Quaternion.identity); } if (random == 4 || random == 5) { TC.StopAllCoroutines(); TC.StartCoroutine("FastTime"); } if (random == 6) { TC.StopAllCoroutines(); TC.StartCoroutine("FreezeTime"); } if (random == 7 || random == 8) { if (collision.GetComponent <Player>().Mod == 1 || collision.GetComponent <Player>().Mod == 2) { Instantiate(HardBall, PlaceLeft.transform.position, Quaternion.identity); Instantiate(HardBall, PlaceRight.transform.position, Quaternion.identity); } else { Instantiate(Pila, PlaceLeft.transform.position, Quaternion.identity); Instantiate(Pila, PlaceMidle.transform.position, Quaternion.identity); Instantiate(Pila, PlaceRight.transform.position, Quaternion.identity); } } if (random == 9 || random == 10) { Instantiate(Heart, PlaceMidle.transform.position, Quaternion.identity); } if (random == 11) { Instantiate(LongerWood, PlaceMidle.transform.position, Quaternion.identity); } Destroy(gameObject); } }
public void OnClickEnter() { if (PlayerPrefs.GetInt("Potion4") > 0) { if (busy == false) { StartCoroutine("Potion4"); TC.StopAllCoroutines(); TC.StartCoroutine("FreezeTime"); } } }