Exemple #1
0
    /// <summary>
    /// Spawn a car if the timer allows.
    /// </summary>
    private void Spawn()
    {
        if (!canSpawn)
        {
            return;
        }
        StartCoroutine(DelaySpawn());
        var        house2spawn = houses [Random.Range(0, houses.Count - 1)];
        GameObject c           = (GameObject)Instantiate(carPrefab, house2spawn.position, house2spawn.rotation);
        CarAI      mycar       = c.GetComponent <CarAI> ();

        mycar.startTravel(houses [Random.Range(0, houses.Count - 1)].position);
    }