void Update() { if (GameManager.Get().HabilitarMovimiento) { GameManager.Get().HabilitarMovimiento = false; mover = true; restaurarMovimiento = true; } if (Time.timeScale != 0) { altitud = transform.position.y; UI_Controller.Get().puntos = puntos; if (mover) { UI_Controller.Get().ContarTiempo(); UI_Controller.Get().altitudJugador = altitud; UI_Controller.Get().gasolinaJugador = gasolina; UI_Controller.Get().velocidadHorizontalJugador = contadorH; UI_Controller.Get().velocidadVerticalJugador = contadorV; if (restaurarMovimiento) { RestaurarMovimiento(); restaurarMovimiento = false; } Movimiento(); } CamaraAterrizaje(); } }
// Use this for initialization public void Jugar() { Time.timeScale = 1; if (GameManager.Get() != null) { GameManager.Get().EnCreditos = false; GameManager.Get().pantallaCarga.SetActive(true); CargarNivel.Get().carga = 0; } SceneManager.LoadScene("Nivel 1"); if (GameManager.Get() != null) { if (GameManager.Get().JuegoEmpezado) { Debug.Log("Entre"); CargarNivel.Get().NumeroNivel = 1; UI_Controller.Get().segundos = 0; UI_Controller.Get().minutos = 0; UI_Controller.Get().puntos = 0; GameManager.Get().nivelActual = 3; PlayerController.Get().velCaida = 0; PasarNivel(); } } }
// Update is called once per frame void Update() { if (UI_Controller.Get().buenAterrizaje == true) { aterrizajeConseguido.SetActive(true); aterrizajeFallido.SetActive(false); } if (UI_Controller.Get().buenAterrizaje == false) { aterrizajeFallido.SetActive(true); aterrizajeConseguido.SetActive(false); } if (GameManager.Get().tipoTextoPuntaje == 0) { textPuntaje.text = " "; } if (GameManager.Get().tipoTextoPuntaje == 1)//puntaje x2 { textPuntaje.text = "60 Puntos"; } if (GameManager.Get().tipoTextoPuntaje == 2)//puntaje x3 { textPuntaje.text = "90 Puntos"; } if (GameManager.Get().tipoTextoPuntaje == 3)//puntaje x4 { textPuntaje.text = "180 Puntos"; } if (GameManager.Get().tipoTextoPuntaje == 4)//puntaje x5 { textPuntaje.text = "250 Puntos"; } }
private void OnCollisionEnter(Collision collision) { if (mover && GameManager.Get().JuegoTerminado == false) { //var fwdSpeed = Vector3.Dot(rig.velocity, transform.forward); float auxVel = collision.relativeVelocity.magnitude;//con esta linea obtengo la velocidad del objeto segun la magnitud de su movimiento //(yo me entiendo). if (collision.gameObject.tag == "x2" && (int)auxVel <= velAterrizaje && this.gameObject.tag == "Jugador") { Quieto(); GameManager.Get().tipoTextoPuntaje = 1; UI_Controller.Get().buenAterrizaje = true; GameManager.Get().pantallaAterrizaje.SetActive(true); mover = false; puntos = puntos + 60; } if (collision.gameObject.tag == "x3" && (int)auxVel <= velAterrizaje && this.gameObject.tag == "Jugador") { Quieto(); GameManager.Get().tipoTextoPuntaje = 2; UI_Controller.Get().buenAterrizaje = true; GameManager.Get().pantallaAterrizaje.SetActive(true); mover = false; puntos = puntos + 90; } if (collision.gameObject.tag == "x4" && (int)auxVel <= velAterrizaje && this.gameObject.tag == "Jugador") { Quieto(); GameManager.Get().tipoTextoPuntaje = 3; UI_Controller.Get().buenAterrizaje = true; GameManager.Get().pantallaAterrizaje.SetActive(true); mover = false; puntos = puntos + 180; } if (collision.gameObject.tag == "x5" && (int)auxVel <= velAterrizaje && this.gameObject.tag == "Jugador") { Quieto(); GameManager.Get().tipoTextoPuntaje = 4; UI_Controller.Get().buenAterrizaje = true; GameManager.Get().pantallaAterrizaje.SetActive(true); mover = false; puntos = puntos + 250; } if ((collision.gameObject.tag == "ZonaMuerte") || (collision.gameObject.tag == "x2" && (int)auxVel > velAterrizaje) || (collision.gameObject.tag == "x3" && (int)auxVel > velAterrizaje) || (collision.gameObject.tag == "x4" && (int)auxVel > velAterrizaje) || (collision.gameObject.tag == "x5" && (int)auxVel > velAterrizaje)) { Quieto(); mover = false; UI_Controller.Get().buenAterrizaje = false; GameManager.Get().pantallaAterrizaje.SetActive(true); GameManager.Get().tipoTextoPuntaje = 0; } } }