IEnumerator Explosion() { yield return(new WaitForSeconds(4)); explotar.SetActive(true); yield return(new WaitForSeconds(0.5f)); usarGranada.objSuelo = false; cambiandoT.CambiarTurno(); Destroy(gameObject); }
IEnumerator Explosion(float duracion) { yield return(new WaitForSeconds(duracion)); vel = 0; explotar.SetActive(true); yield return(new WaitForSeconds(0.5f)); usarSalchicha.objSuelo = false; cambiandoT.CambiarTurno(); Destroy(gameObject); }
private void Inventario() { if (Input.GetKeyDown(botonArmas[0]))//tenedor en mano { CambioArma(0, -5); } else if (Input.GetKeyDown(botonArmas[1]))//pimientero en mano { CambioArma(1, -15); } else if (Input.GetKeyDown(botonArmas[2]))//huevo en mano { CambioArma(2, -6); } else if (Input.GetKeyDown(botonArmas[3]))//albondiga en mano { CambioArma(3, -9); } else if (Input.GetKeyDown(botonArmas[4]))//hot dog en mano { CambioArma(4, -13); } else if (Input.GetKeyDown(botonArmas[5]))//baguette en mano { CambioArma(5, -5); } else if (Input.GetKeyDown(botonArmas[6]))//mostaza en mano { CambioArma(6, -9); } else if (Input.GetKeyDown(botonArmas[7]))//pollo en mano { CambioArma(7, -13); } else if (Input.GetKeyDown(botonArmas[8]))//salami en mano { CambioArma(8, -6); } Vector3 mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0); Physics.Raycast(Camera.main.ScreenPointToRay(mousePos), out hitInfo, 100, rayMask); Vector3 lookPos = hitInfo.point; /*Debug.DrawLine(Camera.main.ScreenPointToRay(mousePos).origin, hitInfo.point, Color.green); * Debug.DrawLine(transform.position, lookPos, Color.red);*/ switch (armaUsando) { case 0: //usar tenedor if (Input.GetMouseButtonDown(0)) { /*Debug.Log("ataco"); * anim1.SetTrigger("Atck1");*/ } break; case 1: //usar pimientero uzi tformArmas[0].LookAt(lookPos); if (Input.GetMouseButton(0) && municion > 0) { Instantiate(prefabArmas[0], tformArmas[0].position, tformArmas[0].rotation); municion--; if (municion <= 0) { soltar = true; cambiandoT.CambiarTurno(); municion = 50; } } break; case 2: //usar mina huevo if (Input.GetMouseButtonDown(0) && !objSuelo) { if (soltar == true) { Instantiate(prefabArmas[1], gObjectArmas[2].transform.position, Quaternion.identity); soltar = false; } } break; case 3: //usar granada albondiga tformArmas[1].LookAt(lookPos); if (Input.GetMouseButtonDown(0) && !objSuelo) { Instantiate(prefabArmas[2], tformArmas[1].transform.position, tformArmas[1].rotation); objSuelo = true; soltar = true; } break; case 4: //usar hot-dog cohete tformArmas[2].LookAt(lookPos); if (Input.GetMouseButtonDown(0) && !objSuelo) { Instantiate(prefabArmas[3], tformArmas[2].position, tformArmas[2].rotation); objSuelo = true; soltar = true; } break; case 5: //usar baguette if (Input.GetMouseButtonDown(0)) { //anim2.SetTrigger("atck2"); } break; case 6: //usar gas mostaza tformArmas[3].LookAt(lookPos); if (Input.GetMouseButtonDown(0) && !objSuelo) { Instantiate(prefabArmas[4], tformArmas[3].transform.position, tformArmas[3].rotation); objSuelo = true; soltar = true; } break; case 7: //usar pollo misil tformArmas[4].LookAt(lookPos); if (Input.GetMouseButtonDown(0) && !objSuelo) { Instantiate(prefabArmas[5], tformArmas[4].transform.position, tformArmas[4].rotation); objSuelo = true; soltar = true; tformCamara.SetActive(false); tformCamara.SetActive(true); } break; case 8: //usar salami dinamita if (Input.GetMouseButtonDown(0) && !objSuelo) { Instantiate(prefabArmas[6], gObjectArmas[8].transform.position, Quaternion.identity); objSuelo = true; soltar = true; } break; } }