Ejemplo n.º 1
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();
        }
    }