Beispiel #1
0
    public void CheckIn(int inccheckpoint, Kart ThisKart)
    {
        Debug.Log(inccheckpoint);
        if (!firstcheckin)
        {
            firstcheckin = true;
        }

        if (inccheckpoint == ThisKart.GetTargetCheckPoint())
        {
            ThisKart.SetTargetCheckPoint(inccheckpoint + 1);
            ThisKart.SetCheckPointValue(0.001f);
            ThisKart.SetCurrentCheckpoint(inccheckpoint);

            if (ThisKart.GetIsNewLap())
            {
                ThisKart.SetIsNewLap(false);
                ThisKart.SetCheckPointValue(1);
                newlaptimer = true;
                if (ThisKart.GetName() == "Player")
                {
                    LapNumberUI.text = "Lap " + ((int)ThisKart.GetCheckPointValue()).ToString() + "/" + LapLength;
                    newlaptimer      = true;
                }
            }

            if (ThisKart.GetTargetCheckPoint() == NumberOfCheckpoints - 2)
            {
                Debug.Log("new lap");
                ThisKart.SetIsNewLap(true);
            }
        }
        PlayerPositions[ThisKart.GetName()] = ThisKart.GetCheckPointValue();
    }
Beispiel #2
0
    public void CheckIn(int inccheckpoint, Kart ThisKart)
    {
        if (!racefinished)
        {
            if (inccheckpoint == ThisKart.GetTargetCheckPoint())
            {
                ThisKart.SetTargetCheckPoint(inccheckpoint + 1);
                ThisKart.SetCheckPointValue(0.001f);
                ThisKart.SetCurrentCheckpoint(inccheckpoint);

                if (ThisKart.GetIsNewLap())
                {
                    ThisKart.SetIsNewLap(false);
                    ThisKart.SetCheckPointValue(1);
                    if (ThisKart.GetName() == "Player")
                    {
                        LapNumberUI.text = "Lap " + ((int)ThisKart.GetCheckPointValue()).ToString() + "/" + LapLength;
                        if (ThisKart.GetCheckPointValue() >= LapLength + 1)
                        {
                            FinalPositions[FinalPositionCount] = ThisKart.GetName();
                            FinalPositionCount = FinalPositionCount + 1;
                            EndRace();
                            return;
                        }
                    }

                    if (ThisKart.GetCheckPointValue() >= LapLength + 1 && ThisKart.GetName() != "Player")
                    {
                        FinalPositions[FinalPositionCount] = ThisKart.GetName();
                        FinalPositionCount = FinalPositionCount + 1;
                    }
                }

                if (ThisKart.GetTargetCheckPoint() == NumberOfCheckpoints - 2)
                {
                    ThisKart.SetIsNewLap(true);
                }
            }
            PlayerPositions[ThisKart.GetName()] = ThisKart.GetCheckPointValue();
        }
    }