Exemplo n.º 1
0
 public void Spawn(List <Vector3> positions, AnimalPool pool)
 {
     for (int i = 0; i < positions.Count; i++)
     {
         EnemyAnimals.Add(pool.GetNext(positions[i]).GetComponent <EnemyAnimal>());
     }
 }
Exemplo n.º 2
0
    public void SpawnAnimals(GameObject animal, AnimalPool pool)
    {
        int            animalCount     = animal.transform.childCount;
        List <Vector3> animalPositions = new List <Vector3>(animalCount);

        foreach (Transform animalPos in animal.transform)
        {
            animalPositions.Add(animalPos.position);
        }

        ai.Spawn(animalPositions, pool);
    }
Exemplo n.º 3
0
 void Awake()
 {
     SquirrelPool = new AnimalPool(squirrel);
     SquirrelPool.InitializePool();
     HarePool = new AnimalPool(hare);
     HarePool.InitializePool();
     DeerPool = new AnimalPool(deer);
     DeerPool.InitializePool();
     WolfPool = new AnimalPool(wolf);
     WolfPool.InitializePool();
     BearPool = new AnimalPool(bear);
     BearPool.InitializePool();
 }
Exemplo n.º 4
0
        private void CreateAnimalsPool()
        {
            // Instantiating a new prefab memory pool for Animals
            AnimalPool prefabPool = Container.Instantiate <AnimalPool>(new object[]
            {
                new MemoryPoolSettings()
                {
                    MaxSize     = 5,
                    InitialSize = 2
                },
                //new MemoryPoolSettings(),
                new AnimalFactory(Container)
            }
                                                                       );

            // set parent transform for prefab memory pool
            prefabPool.SetTransformGroup(_prefabContainer);
            Container.BindInstance(prefabPool).AsSingle();
        }
Exemplo n.º 5
0
 void Awake()
 {
     instance = this;
 }