Exemplo n.º 1
0
    public void UnregisterPickup(TargetObject pickupCollected)
    {
        if (pickupCollected.gameMode != gameMode)
        {
            return;
        }

        // removes the pickup from the list, so that we can keep track of how many are left on the map
        if (pickupCollected.gameMode == GameMode.Laps)
        {
            pickupCollected.active = false;

            LapObject lapObject = (LapObject)pickupCollected;

            if (!lapObject.finishLap)
            {
                return;
            }

            if (!lapObject.lapOverNextPass)
            {
                TimeDisplay.OnUpdateLap();
                lapObject.lapOverNextPass = true;
                return;
            }

            if (NumberOfActivePickupsRemaining() != 0)
            {
                return;
            }

            ReachCheckpoint(0);
            ResetPickups();
            TimeDisplay.OnUpdateLap();
        }
        else if (pickupCollected.gameMode == GameMode.GetTime)
        {
            if (pickupCollected is LapObject)
            {
                ReachCheckpoint(0);
            }
            else
            {
                ReachCheckpoint(NumberOfPickupsRemaining - 1);
            }
        }
        else
        {
            ReachCheckpoint(NumberOfPickupsRemaining - 1);
            Pickups.Remove(pickupCollected);
            if (gameMode == GameMode.Laps)
            {
                KartGame.Track.TimeDisplay.OnUpdateLap();
            }
        }
    }
Exemplo n.º 2
0
    public void UnregisterPickup(TargetObject pickupCollected)
    {
        if (pickupCollected.gameMode != gameMode)
        {
            return;
        }

        // removes the pickup from the list, so that we can keep track of how many are left on the map
        if (pickupCollected.gameMode == GameMode.Laps)
        {
            pickupCollected.active = false;
            LapObject lapObject = (LapObject)pickupCollected;

            if (!lapObject.finishLap)
            {
                return;                     //Si el objeto no es la linea de meta no ejecuta las siguientes lineas
            }
            if (!lapObject.lapOverNextPass) //La primera vez que pasa por linea de meta, actualiza las vueltas e incia el tiempo
            {
                TimeDisplay.OnUpdateLap();
                if (configuration.activeObjects)
                {
                    textRank.gameObject.SetActive(true);
                }
                Item.SetActive(true);
                lapObject.lapOverNextPass = true;
                return;
            }

            if (NumberOfActivePickupsRemaining() != 0)
            {
                return;
            }
            ReachCheckpoint(0, isTimed, lapObject.TimeGained);
            ResetPickups();
            TimeDisplay.OnUpdateLap();
            if (isTimed)
            {
                TimeManager.OnAdjustTime(lapObject.TimeGained);
            }
        }
        else
        {
            ReachCheckpoint(NumberOfPickupsRemaining - 1, isTimed, 0);
            Pickups.Remove(pickupCollected);
            if (gameMode == GameMode.Laps)
            {
                KartGame.Track.TimeDisplay.OnUpdateLap();
            }
        }
    }