Beispiel #1
0
 public void Update()
 {
     temporizador.Update();
 }
Beispiel #2
0
        private void Update()
        {
            temporizador.Update();

            if (uipuntaje != null)
            {
                uipuntaje.SetNumero(puntaje);
            }
            if (uipuntajemaximo != null)
            {
                uipuntajemaximo.SetNumero(puntajemaximo);
            }

            if (uividabarra != null)
            {
                uividabarra.SetValor(jugador.GetVida(true));
            }
            if (uividanumero != null)
            {
                uividanumero.SetNumero(jugador.GetVida());
            }
            if (uividasnumero != null)
            {
                uividasnumero.SetNumero(vidas);
            }

            if (uienergiabarra != null)
            {
                uienergiabarra.SetValor(jugador.GetEnergia(true));
            }
            if (uienergianumero != null)
            {
                uienergianumero.SetNumero(jugador.GetEnergia());
            }
            if (uidificultadbarra != null)
            {
                uidificultadbarra.SetValor(GetDificultad());
            }

            if (IsEstado(GameplayEstado.JUGANDO))
            {
                if (jugador != null)
                {
                    if (jugador.GetVida(true) <= 0.0f)
                    {
                        jugador.Muerte();
                        vidas--;
                    }
                    if (jugador.IsMuerto())
                    {
                        if (vidas <= 0)
                        {
                            vidas = 0;
                            SetEstado(GameplayEstado.PERDER);
                        }
                        else
                        {
                            if (!jugador.IsReviviendo())
                            {
                                jugador.Revivir();
                            }
                        }
                    }
                }

                switch (tipo)
                {
                case GameplayTipo.INFINITO:
                    int puntajedificultad = (puntajedeseado > puntajemaximo) ? puntajedeseado : puntajemaximo;
                    SetDificultad((float)puntaje / (float)puntajedificultad);
                    break;

                case GameplayTipo.PUNTAJE:
                    SetDificultad((float)puntaje / (float)puntajemaximo);
                    if (puntaje >= puntajemaximo)
                    {
                        SetEstado(GameplayEstado.GANAR);
                    }
                    break;

                case GameplayTipo.TIEMPO:
                    SetDificultad(temporizador.GetTiempo(true));
                    if (temporizador.GetTiempo(true) >= 1.0f)
                    {
                        SetEstado(GameplayEstado.GANAR);
                    }
                    break;
                }
            }
        }