Esempio n. 1
0
        static void Main(string[] args)
        {
            Race      race = new Race();
            RaceCar   car1 = new RaceCar("Test 1");
            RaceCar   car2 = new RaceCar("Test 2");
            StreetCar car3 = new StreetCar("Test 3");
            string    str;

            race.AddRacer(car1);
            race.AddRacer(car2);
            race.AddRacer(car3);
            str = race.PrintRacers();
        }
Esempio n. 2
0
        public void Process()
        {
            if (Race != null && Race.UnprocessedLaps != null)
            {
                foreach (string UnprocessedLap in Race.UnprocessedLaps)
                {
                    string ul = UnprocessedLap;

                    ul = PartString(ul, ProcessRaceFieldLength.Hour, out string hour);
                    ul = PartString(ul, ProcessRaceFieldLength.RacerCode, out string racerCode);
                    ul = PartString(ul, GetFirstNumberOccurrenceIndex(ul), out string racerName);
                    ul = PartString(ul, ProcessRaceFieldLength.LapNumber, out string lapNumber);
                    ul = PartString(ul, ProcessRaceFieldLength.LapTime, out string lapTime);
                    string lapAVGSpeed = ul;

                    if (racerCode.Length > 2)
                    {
                        racerCode = racerCode.Substring(0, 3);
                    }

                    if (!TryGetRacer(racerCode, out Racer racer))
                    {
                        racer = CreateRacer(racerCode, racerName);
                        Race.AddRacer(racer);
                    }

                    Lap lap = CreateLap(hour, lapNumber, lapTime, lapAVGSpeed);

                    if (lap.LapNumber <= 4 && racer.Laps.Count < 4)
                    {
                        racer.AddLap(CreateLap(hour, lapNumber, lapTime, lapAVGSpeed));
                    }
                }
            }
        }
Esempio n. 3
0
    internal void ResetRace()
    {
        if (!NetworkCore.isServer)
        {
            return;
        }
        // setup a new race
        currentRace = new Race(this);
        currentRace.Init(0.4f, 5, 5, 20);

        for (int i = 0; i < cars.Length; i++)
        {
            // find spawn point
            SpawnArea area = spawnZone.GetSpawn(i);
            BaseCar   car  = cars[i];

            car.pDriver.isGhost = false;
            car.pGhostControl.SetGhostMode(false);

            car.Restart(area.position, area.rotation);
            currentRace.AddRacer(car);
        }

        // notify any listeners of this event
        if (RaceRestartEvent != null)
        {
            RaceRestartEvent();
        }
    }
Esempio n. 4
0
        private void добавитьНовогоУчастникаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddNewBolideFrom anr = new AddNewBolideFrom();

            if (anr.ShowDialog() == DialogResult.OK)
            {
                string name = anr.GetName;
                try
                {
                    race.AddRacer(name);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }