Exemple #1
0
    //Spider methods
    public SpiderAIBehaviour GetSpider(bool random, Vector3 position)
    {
        if (random)
        {
            return(GetSpider(ChromaColorInfo.Random, position));
        }

        //Get a spider from pool
        SpiderAIBehaviour spider = spiderPool.GetObject(position);

        if (spider != null)
        {
            spider.color = currentColor;
            spider.SetMaterials(new[] { currentSpiderMat });
            return(spider);
        }

        return(null);
    }
    public GameObject GetMonsterFromName(string monsterName)
    {
        ObjectPool pool;

        if (_monstersPools.TryGetValue(monsterName, out pool))
        {
            var monster = pool.GetObject();
            monster.SetActive(true);
            return(monster);
        }
        return(SpiderPool.GetObject());
    }