Esempio n. 1
0
 public void SpawnType(spawnable type)
 {
     for (int i = 0; i < spawnAll.Count; i++)
     {
         if (spawnAll[i].type == type)
         {
             Spawn(spawnAll[i].prefab, type);
             return;
         }
     }
 }
Esempio n. 2
0
    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;
        }
    }