public void SpawnType(spawnable type) { for (int i = 0; i < spawnAll.Count; i++) { if (spawnAll[i].type == type) { Spawn(spawnAll[i].prefab, type); return; } } }
private void Spawn(GameObject prefab, spawnable type) { GameObject newCreature = Instantiate(prefab, Vector3.zero, Quaternion.identity); switch (type) { case spawnable.creature: newCreature.GetComponent <Creature>().OnInstantiate(); break; case spawnable.customer: newCreature.GetComponent <Customer>().OnInstantiate(); break; } }