void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Player") { DataTravel fexs = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <DataTravel>(); itemG.enabled = true; if (fexs.efectos == 1) { mus.Play(); } Destroy(gameObject, 1f); } else if (other.gameObject.tag == "Enemigo" || other.gameObject.tag == "BalaEnm") { Destroy(gameObject); SpawnCenter discon = GameObject.FindGameObjectWithTag("Spawn").GetComponent <SpawnCenter> (); discon.enmMax += 2; discon.enmMaxRonda += 2; discon.enmRest += 2; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Spawn"); GameObject.FindGameObjectWithTag("Spawn").SendMessage("Spawn"); } else if (other.gameObject.tag == "Bala") { Destroy(gameObject); SpawnCenter discon = GameObject.FindGameObjectWithTag("Spawn").GetComponent <SpawnCenter> (); discon.enmMax += 3; discon.enmMaxRonda += 3; discon.enmRest += 3; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Spawn"); GameObject.FindGameObjectWithTag("Spawn").SendMessage("Spawn"); GameObject.FindGameObjectWithTag("Spawn").SendMessage("Spawn"); } }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Bala") { vidaE -= bala; if (vidaE <= 0) { Freno(); Destroy(gameObject, 4f); if (spa == 1) { spa = 0; fueg.SetActive(true); yorb.isKinematic = true; SpawnCenter discon = GameObject.FindGameObjectWithTag("Spawn").GetComponent <SpawnCenter> (); discon.enmMax += 1; discon.enmRest -= 1; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Spawn"); Respawn ben = GameObject.FindGameObjectWithTag("Spawn").GetComponent <Respawn> (); ben.puntaje += beneficio; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Puntos"); } } } else if (other.gameObject.tag == "Player") { } else if (other.gameObject.tag == "Explosivo" || other.gameObject.tag == "ExploEnm") { vidaE -= explo; if (vidaE <= 0) { Freno(); Destroy(gameObject, 4f); if (spa == 1) { spa = 0; fueg.SetActive(true); yorb.isKinematic = true; SpawnCenter discon = GameObject.FindGameObjectWithTag("Spawn").GetComponent <SpawnCenter> (); discon.enmMax += 1; discon.enmRest -= 1; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Spawn"); Respawn ben = GameObject.FindGameObjectWithTag("Spawn").GetComponent <Respawn> (); ben.puntaje += beneficio; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Puntos"); } } } else { ranDireccion(); } }
public void Rest() { Time.timeScale = 1.0f; fondo.SetActive(false); fondo2.SetActive(false); pausa.SetActive(false); seguir.SetActive(false); casa.SetActive(false); joyst.SetActive(true); buttn.SetActive(true); pausee.SetActive(true); DataTravel hys = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <DataTravel>(); hys.scenes = 0; GameObject.FindGameObjectWithTag("Player").SendMessage("kinem"); GameObject.FindGameObjectWithTag("EnemCenter").SendMessage("Destro"); PlayerControler vivv = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControler> (); vivv.vivo = true; vivv.MovementSpeed = 0.05f; SpawnCenter uno = GameObject.FindGameObjectWithTag("Spawn").GetComponent <SpawnCenter> (); uno.enmMaxRonda = 10; uno.enmMax = 4; Respawn dos = GameObject.FindGameObjectWithTag("Spawn").GetComponent <Respawn> (); dos.vidas = 3; dos.puntaje = 0; HealtItem h = GameObject.FindGameObjectWithTag("Player").GetComponent <HealtItem> (); h.vi = true; h.shield = false; h.vida = 100; h.balDis = 0.5f; h.dispMax = 1; can.SetActive(false); manu.SetActive(true); GameObject.FindGameObjectWithTag("MainCamera").SendMessage("muenuss"); enem.SetActive(false); GameObject.FindGameObjectWithTag("MainCamera").SendMessage("destruMa"); GameObject.FindGameObjectWithTag("Menu").SendMessage("inic"); GameObject.FindGameObjectWithTag("Spawn").SendMessage("inicio2"); sps.SetActive(false); GameObject.FindGameObjectWithTag("BalaEnm").SendMessage("destro"); }
IEnumerator reini() { yield return(new WaitForSeconds(secon)); DataTravel hys = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <DataTravel>(); hys.scenes = 0; GameObject.FindGameObjectWithTag("Player").SendMessage("kinem"); GameObject.FindGameObjectWithTag("EnemCenter").SendMessage("Destro"); PlayerControler vivv = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControler> (); vivv.vivo = true; vivv.MovementSpeed = 0.05f; SpawnCenter uno = GameObject.FindGameObjectWithTag("Spawn").GetComponent <SpawnCenter> (); uno.enmMaxRonda = 10; uno.enmMax = 4; Respawn dos = GameObject.FindGameObjectWithTag("Spawn").GetComponent <Respawn> (); dos.vidas = 3; dos.puntaje = 0; HealtItem h = GameObject.FindGameObjectWithTag("Player").GetComponent <HealtItem> (); h.vi = true; h.shield = false; h.vida = 100; h.balDis = 0.5f; h.dispMax = 1; can.SetActive(false); manu.SetActive(true); GameObject.FindGameObjectWithTag("MainCamera").SendMessage("muenuss"); enem.SetActive(false); GameObject.FindGameObjectWithTag("MainCamera").SendMessage("destruMa"); GameObject.FindGameObjectWithTag("Menu").SendMessage("inic"); GameObject.FindGameObjectWithTag("Spawn").SendMessage("inicio2"); sps.SetActive(false); GameObject.FindGameObjectWithTag("BalaEnm").SendMessage("destro"); }