Ejemplo n.º 1
0
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactEnergyRecoverySystem.ImpactType.Banned:
            inRules.IsEnergySystemActive = false;
            break;

        case PoliticalImpactEnergyRecoverySystem.ImpactType.LargeBatteries:
            inRules.IsEnergySystemActive = true;
            inRules.BatterySize          = ChampionshipRules.EnergySystemBattery.Large;
            break;

        case PoliticalImpactEnergyRecoverySystem.ImpactType.SmallBatteries:
            inRules.IsEnergySystemActive = true;
            inRules.BatterySize          = ChampionshipRules.EnergySystemBattery.Small;
            break;

        case PoliticalImpactEnergyRecoverySystem.ImpactType.ActiveHybrid:
            inRules.IsHybridModeActive = true;
            break;

        case PoliticalImpactEnergyRecoverySystem.ImpactType.InactiveHybrid:
            inRules.IsHybridModeActive = false;
            break;

        case PoliticalImpactEnergyRecoverySystem.ImpactType.ActiveChargeFromStandings:
            inRules.ShouldChargeUsingStandingsPosition = true;
            break;

        case PoliticalImpactEnergyRecoverySystem.ImpactType.InactiveChargeFromStandings:
            inRules.ShouldChargeUsingStandingsPosition = false;
            break;
        }
    }
Ejemplo n.º 2
0
        public void Test_semi_finals_rule()
        {
            var teamA = new Movie {
                Titulo = "A"
            };
            var teamB = new Movie {
                Titulo = "B"
            };
            var teamC = new Movie {
                Titulo = "C"
            };
            var teamD = new Movie {
                Titulo = "D"
            };

            var teams = new List <Movie> {
                teamA, teamB, teamC, teamD
            };

            var mock = new Mock <IMatchRules>();

            var semiFinals = new List <Match>
            {
                new Match(mock.Object),
                new Match(mock.Object)
            };

            var matches = new ChampionshipRules().SemifinalsRule(teams, semiFinals);

            matches[0].HomeTeam.ShouldBe(teamA);
            matches[0].AwayTeam.ShouldBe(teamB);
            matches[1].HomeTeam.ShouldBe(teamC);
            matches[1].AwayTeam.ShouldBe(teamD);
        }
Ejemplo n.º 3
0
 public void ApplyImpacts(ChampionshipRules inRules)
 {
     for (int index = 0; index < this.impacts.Count; ++index)
     {
         this.impacts[index].SetImpact(inRules);
     }
 }
    public override void SetImpact(ChampionshipRules inRules)
    {
        List <float> floatList      = new List <float>();
        int          teamEntryCount = inRules.championship.standings.teamEntryCount;
        int          prizeFund      = inRules.championship.prizeFund;
        float        num1           = (1f - this.poolPercentageSplit01).Clamp(0f, 1f) * (float)prizeFund / (float)teamEntryCount;
        float        num2           = this.poolPercentageSplit01 * (float)prizeFund;
        float        num3           = 0.0f;

        for (int index = 0; index < teamEntryCount; ++index)
        {
            float num4 = EasingUtility.EaseByType(this.curveType, 0.0f, 1f, 1f - ((float)index / (float)teamEntryCount).Clamp(0f, 1f));
            num3 += num4;
        }
        float num5 = 1f / num3;

        for (int index = 0; index < teamEntryCount; ++index)
        {
            float num4 = EasingUtility.EaseByType(this.curveType, 0.0f, 1f, 1f - ((float)index / (float)teamEntryCount).Clamp(0f, 1f));
            float num6 = ((num1 + num2 * num4 * num5) / (float)prizeFund).Clamp(0f, 1f) * 100f;
            floatList.Add(num6);
        }
        inRules.prizePoolPercentage.Clear();
        inRules.prizePoolPercentage = new List <float>((IEnumerable <float>)floatList);
    }
Ejemplo n.º 5
0
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactSpecPart.ImpactType.Activate:
            for (int index = 0; index < this.partTypes.Count; ++index)
            {
                CarPart.PartType partType = this.partTypes[index];
                if (!inRules.SpecParts.Contains(partType))
                {
                    inRules.SpecParts.Add(this.partTypes[index]);
                }
            }
            inRules.ApplySpecParts();
            break;

        case PoliticalImpactSpecPart.ImpactType.Remove:
            for (int index = 0; index < this.partTypes.Count; ++index)
            {
                CarPart.PartType partType = this.partTypes[index];
                if (inRules.SpecParts.Contains(partType))
                {
                    inRules.SpecParts.Remove(partType);
                    inRules.GenerateDefaultParts(partType);
                }
            }
            break;
        }
    }
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactDriverAids.ImpactType.Active:
            inRules.DriverAidsOn = true;
            break;

        case PoliticalImpactDriverAids.ImpactType.Banned:
            inRules.DriverAidsOn = false;
            break;
        }
    }
Ejemplo n.º 7
0
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactFuelSettings.ImpactType.Limit:
            inRules.FuelLimitForRaceDistanceNormalized = this.fuelLimit / 100f;
            break;

        case PoliticalImpactFuelSettings.ImpactType.Refueling:
            inRules.IsRefuelingOn = this.refuelling;
            break;
        }
    }
Ejemplo n.º 8
0
        public void Test_quarter_finals_rule()
        {
            var teamA = new Movie {
                Titulo = "A"
            };
            var teamB = new Movie {
                Titulo = "B"
            };
            var teamC = new Movie {
                Titulo = "C"
            };
            var teamD = new Movie {
                Titulo = "D"
            };
            var teamE = new Movie {
                Titulo = "E"
            };
            var teamF = new Movie {
                Titulo = "F"
            };
            var teamG = new Movie {
                Titulo = "G"
            };
            var teamH = new Movie {
                Titulo = "H"
            };

            var mock = new Mock <IMatchRules>();

            var teams = new List <Movie> {
                teamA, teamB, teamC, teamD, teamE, teamF, teamG, teamH
            };
            var quarterFinals = new List <Match>
            {
                new Match(mock.Object),
                new Match(mock.Object),
                new Match(mock.Object),
                new Match(mock.Object)
            };

            var matches = new ChampionshipRules().QuarterFinalsRule(teams, quarterFinals);

            matches[0].HomeTeam.ShouldBe(teamA);
            matches[0].AwayTeam.ShouldBe(teamH);
            matches[1].HomeTeam.ShouldBe(teamB);
            matches[1].AwayTeam.ShouldBe(teamG);
            matches[2].HomeTeam.ShouldBe(teamC);
            matches[2].AwayTeam.ShouldBe(teamF);
            matches[3].HomeTeam.ShouldBe(teamD);
            matches[3].AwayTeam.ShouldBe(teamE);
        }
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactRaceType.ImpactType.Active:
            inRules.raceType          = ChampionshipRules.RaceType.Time;
            inRules.raceLengthInHours = this.mSessionLengthInHours;
            break;

        case PoliticalImpactRaceType.ImpactType.Banned:
            inRules.raceType = ChampionshipRules.RaceType.Laps;
            break;
        }
    }
    public override void SetImpact(ChampionshipRules inRules)
    {
        int qualifyingSessionCount1 = inRules.GetQualifyingSessionCount();

        inRules.GridSetup1 = this.GetSetup(this.impactType);
        int qualifyingSessionCount2 = inRules.GetQualifyingSessionCount();

        if (qualifyingSessionCount1 == qualifyingSessionCount2)
        {
            return;
        }
        //inRules.championship.GenerateNextYearCalendar(false);
        //inRules.championship.SetupNextYearCalendarWeather();
    }
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactSafetyCar.ImpactType.VirtualSafetyCar:
            inRules.SafetyCarUsage1 = ChampionshipRules.SafetyCarUsage.VirtualSafetyCar;
            break;

        case PoliticalImpactSafetyCar.ImpactType.SafetyCar:
            inRules.SafetyCarUsage1 = ChampionshipRules.SafetyCarUsage.RealSafetyCar;
            break;

        case PoliticalImpactSafetyCar.ImpactType.Both:
            inRules.SafetyCarUsage1 = ChampionshipRules.SafetyCarUsage.Both;
            break;
        }
    }
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactPitStopCrew.ImpactType.Small:
            inRules.PitCrewSize = ChampionshipRules.PitStopCrewSize.Small;
            break;

        case PoliticalImpactPitStopCrew.ImpactType.Large:
            inRules.PitCrewSize = ChampionshipRules.PitStopCrewSize.Large;
            break;

        case PoliticalImpactPitStopCrew.ImpactType.SemiSequential:
            inRules.PitCrewSize = ChampionshipRules.PitStopCrewSize.SemiSequential;
            break;
        }
    }
Ejemplo n.º 13
0
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactSessionLength.ImpactType.PracticeSession:
            inRules.practiceSettings = Game.instance.simulationSettingsManager.practiceSettings[this.sessionLength];
            break;

        case PoliticalImpactSessionLength.ImpactType.QualifyingSession:
            inRules.qualifyingSettings = Game.instance.simulationSettingsManager.qualifyingSettings[this.sessionLength];
            break;

        case PoliticalImpactSessionLength.ImpactType.RaceSession:
            inRules.raceSettings = Game.instance.simulationSettingsManager.raceSettings[this.sessionLength];
            break;
        }
        inRules.ApplySimulationSettings();
    }
Ejemplo n.º 14
0
    public void Apply(ChampionshipRules inRules)
    {
        switch (this.sessionType)
        {
        case SessionDetails.SessionType.Practice:
            inRules.PracticeDuration.Clear();
            inRules.PracticeDuration.Add(GameUtility.MinutesToSeconds((float)this.duration));
            break;

        case SessionDetails.SessionType.Qualifying:
            inRules.QualifyingDuration.Clear();
            inRules.QualifyingDuration.Add(GameUtility.MinutesToSeconds((float)this.duration));
            break;

        case SessionDetails.SessionType.Race:
            inRules.raceLength.Clear();
            inRules.raceLength.Add(this.sessionLength);
            break;
        }
    }
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactTyreSettings.ImpactType.TyreType:
            inRules.tyreType = this.tyreType;
            //this.ChangeWheelGFX();
            break;

        case PoliticalImpactTyreSettings.ImpactType.WearRate:
            inRules.TyreWearRate1 = this.wearRate;
            break;

        case PoliticalImpactTyreSettings.ImpactType.Speed:
            inRules.TyreSpeedBonus = this.speedModifier;
            break;

        case PoliticalImpactTyreSettings.ImpactType.SpeedBonus:
            inRules.TyreSupplierBonus = this.speedBonusModifier;
            break;

        case PoliticalImpactTyreSettings.ImpactType.Supplier:
            inRules.tyreSupplier   = this.tyreSupplier;
            inRules.tyreSupplierID = !(this.tyreSupplier == "Ristrelli") ? 1 : 0;
            //this.ChangeWheelGFX();
            break;

        case PoliticalImpactTyreSettings.ImpactType.CompoundChoice:
            inRules.CompoundChoice1 = this.compoundChoice;
            break;

        case PoliticalImpactTyreSettings.ImpactType.CompoundAvailable:
            inRules.CompoundsAvailable = this.tyreCompoundsAvailable;
            break;

        case PoliticalImpactTyreSettings.ImpactType.TyresAvailable:
            inRules.MaxSlickTyresPerEvent = this.tyresAvailable;
            break;
        }
    }
Ejemplo n.º 16
0
        public void Test_sort_teams_rule()
        {
            var teamA = new Movie {
                Titulo = "A", Nota = 10
            };
            var teamB = new Movie {
                Titulo = "B", Nota = 10
            };
            var teamC = new Movie {
                Titulo = "C", Nota = 10
            };

            var teams = new List <Movie> {
                teamC, teamB, teamA
            };

            var championshipRules = new ChampionshipRules();

            var orderedTeams = championshipRules.SortTeamsRule(teams);

            orderedTeams.First().ShouldBe(teamA);
            orderedTeams.Last().ShouldBe(teamC);
        }
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactPoints.ImpactType.Points:
            inRules.Points.Clear();
            inRules.Points = new List <int>((IEnumerable <int>) this.points);
            break;

        case PoliticalImpactPoints.ImpactType.FinalRacePoints:
            if (this.remove)
            {
                inRules.FinalRacePointsDouble = false;
                break;
            }
            inRules.FinalRacePointsDouble = true;
            break;

        case PoliticalImpactPoints.ImpactType.FastestLap:
            if (this.remove)
            {
                inRules.FastestLapPointBonus = 0;
                break;
            }
            inRules.FastestLapPointBonus = 2;
            break;

        case PoliticalImpactPoints.ImpactType.PoleBonus:
            if (this.remove)
            {
                inRules.PolePositionPointBonus = 0;
                break;
            }
            inRules.PolePositionPointBonus = 2;
            break;
        }
    }
 public override void SetImpact(ChampionshipRules inRules)
 {
     inRules.PitlaneSpeed = this.pitlaneSpeed;
 }
 public override void SetImpact(ChampionshipRules inRules)
 {
     inRules.isWeightStrippingEnabled = this.mEnabled;
 }
 public override void SetImpact(ChampionshipRules inRules)
 {
     inRules.PromotionBonus = this.active;
 }
    public override void SetImpact(ChampionshipRules inRules)
    {
        switch (this.impactType)
        {
        case PoliticalImpactChangeTrack.ImpactType.ChangeTrackLayout:
            for (int index = 0; index < inRules.championship.calendarData.Count; ++index)
            {
                RaceEventCalendarData eventCalendarData = inRules.championship.calendarData[index];
                if (eventCalendarData.circuit == this.trackAffected)
                {
                    eventCalendarData.circuit = this.trackLayout;
                    break;
                }
                //Console.WriteLine("Rule Impact - " + inRules.championship.GetChampionshipName(false, string.Empty) + " - " + this.impactType.ToString() + " - Track - " + this.trackAffected.locationName), (UnityEngine.Object)null);
            }
            break;

        case PoliticalImpactChangeTrack.ImpactType.TrackReplace:
            Debug.Assert(this.newTrack != null, "Rule Change Track Replace - Track is Null");
            if (this.newTrack == null)
            {
                return;
            }
            for (int index = 0; index < inRules.championship.calendarData.Count; ++index)
            {
                RaceEventCalendarData eventCalendarData = inRules.championship.calendarData[index];
                if (eventCalendarData.circuit == this.trackAffected)
                {
                    eventCalendarData.circuit = this.newTrack;
                    break;
                }
            }
            //Debug.Log((object)("Rule Impact - " + inRules.championship.GetChampionshipName(false, string.Empty) + " - " + this.impactType.ToString() + " - Replaced - " + this.trackAffected.locationName + " - With - " + this.newTrack.locationName), (UnityEngine.Object)null);
            break;

        case PoliticalImpactChangeTrack.ImpactType.AddTrack:
        case PoliticalImpactChangeTrack.ImpactType.AddTrackLayout:
            Debug.Assert(this.newTrack != null, "Rule Change Add Track - Track is Null");
            if (this.newTrack == null)
            {
                return;
            }
            inRules.championship.calendarData.Add(new RaceEventCalendarData()
            {
                circuit = this.newTrack
            });
            // Debug.Log((object)("Rule Impact - " + inRules.championship.GetChampionshipName(false, string.Empty) + " - " + this.impactType.ToString() + " - " + this.newTrack.locationName), (UnityEngine.Object)null);
            break;

        case PoliticalImpactChangeTrack.ImpactType.RemoveTrack:
            for (int index = 0; index < inRules.championship.calendarData.Count; ++index)
            {
                RaceEventCalendarData eventCalendarData = inRules.championship.calendarData[index];
                if (eventCalendarData.circuit == this.trackAffected)
                {
                    inRules.championship.calendarData.Remove(eventCalendarData);
                    break;
                }
            }
            //Debug.Log((object)("Rule Impact - " + inRules.championship.GetChampionshipName(false, string.Empty) + " - " + this.impactType.ToString() + " - " + this.trackAffected.locationName), (UnityEngine.Object)null);
            break;
        }
        //inRules.championship.RecalculateNextYearCalendarWeeks();
        //inRules.championship.GenerateNextYearCalendar(false);
        //inRules.championship.SetupNextYearCalendarWeather();
    }
Ejemplo n.º 22
0
 public override void SetImpact(ChampionshipRules inRules)
 {
     inRules.raceStart = this.raceStart;
 }
Ejemplo n.º 23
0
 public override void SetImpact(ChampionshipRules inRules)
 {
     inRules.drivingTimeEndurance = this.mDrivingTime;
 }
Ejemplo n.º 24
0
 public abstract void SetImpact(ChampionshipRules inRules);
 public override void SetImpact(ChampionshipRules inRules)
 {
     inRules.LastPlaceBonus = this.active;
 }
Ejemplo n.º 26
0
 public override void SetImpact(ChampionshipRules inRules)
 {
     inRules.IsSprinklingSystemOn = this.active;
 }