コード例 #1
0
    public void DoALap(bool pitstop = false)
    {
        int code       = race.DoALap(pitstop);
        int difference = race.GetMainPlayerPosition() - lastPosition;

        if (difference != 0)
        {
            lastPosition = race.GetMainPlayerPosition();
            code         = 2;
        }

        //Update Actions
        switch (code)
        {
        case 2: {
            actions.OvertakingAction(difference);
            break;
        }

        case 1: {
            actions.NormalAction();
            break;
        }

        case -1: {
            Debug.Log("Final Position: " + race.GetMainPlayerPosition());
            actions.FinalAction(race.GetMainPlayerPosition());
            break;
        }

        case -100: {
            actions.MotorFailure();
            break;
        }

        case -200: {
            actions.GearboxFailure();
            break;
        }

        case -300: {
            actions.SuspensionFailure();
            break;
        }

        case -400: {
            actions.BreaksFailure();
            break;
        }

        case -500: {
            actions.TyresFailure();
            break;
        }

        case -600: {
            actions.FuelFailure();
            break;
        }

        default: {
            break;
        }
        }
    }