IEnumerator SpawnRoutine() { while (true) { SpawningPoint spawningPoint = spawningPoints[UnityEngine.Random.Range(0, spawningPoints.Count)]; GameObject prefab = UnityEngine.Random.value < GetBusChance() ? busPrefab : carPrefab; Car car = Instantiate(prefab, spawningPoint.pos, Quaternion.identity, transform).GetComponent <Car>(); car.Init(player.transform, spawningPoint.dest); yield return(new WaitForSeconds(GetSpawnDelay())); } }
public void GetAtributeShouldReturnAttributeWhenTileContainsTheSpecifiedAttribute() { SpawningPoint expected = new SpawningPoint(); this.tile.AddAttribute(expected); Assert.AreEqual(expected, this.tile.GetAttribute<SpawningPoint>(Type.SPAWNING_POINT)); }