Пример #1
0
        public void Init()
        {
            //init building pool
            _gameplayCam   = GameObject.FindObjectOfType <GameplayCamera>();
            _gameBoard     = GameObject.FindObjectOfType <GameBoard>();
            _buildHologram = GameObject.Instantiate <BuildHologram>(_buildConfig.buildHologram);

            GameObject pool = GameObject.FindGameObjectWithTag("ScenePool");

            if (!pool)
            {
                Debug.LogError("NO SCENE POOL TRANSFORM FOUND IN SCENE");
            }
            _buildingGenerator = new GenericPooler(pool ? pool.transform : null);
            BuildConfig.BuildableBlueprint[] blueprints = _buildConfig.buildables;
            for (int i = 0; i < blueprints.Length; i++)
            {
                BuildConfig.BuildableBlueprint blueprint = blueprints[i];
                _buildingGenerator.InitPool(blueprint.GetKey(), 10, blueprint.prefab);
            }

            //UI
            _buildViewController = new BuildViewController(this, _inventorySystem, _buildConfig);

            //Build Cam
            //_buildCam = new BuildCam(_buildConfig,_gameplayCam);

            //init currenty build type
            SetBuildType(_buildConfig.startingBuildType);
        }
Пример #2
0
        public void Init()
        {
            //Init Loot Pooler
            GameObject pool = GameObject.FindGameObjectWithTag("ScenePool");

            if (!pool)
            {
                Debug.LogError("NO SCENE POOL TRANSFORM FOUND IN SCENE");
            }
            _lootPool = new GenericPooler(pool ? pool.transform : null);


            List <LootConfig.LootDef> lootDefs = _lootConfig.lootDefs;

            for (int i = 0; i < lootDefs.Count; i++)
            {
                LootConfig.LootDef            def   = lootDefs[i];
                List <LootConfig.LootItemDef> items = def.lootItems;
                int warmAmount = def.pooledWarmAmount;
                for (int j = 0; j < items.Count; j++)
                {
                    LootConfig.LootItemDef item = items[j];
                    string type = Storeable.GetCachedStoreableKey(item.type);
                    _lootPool.InitPool(type, warmAmount, item.prefab);
                }
            }

            _dispatcher.AddListener(GameplayEventType.ENEMY_KILLED, OnEnemyDestroyed);
        }
 private void AddToPool(ParticleConfig.ParticleBlueprint[] particles)
 {
     for (int i = 0; i < particles.Length; i++)
     {
         ParticleConfig.ParticleBlueprint particle = particles[i];
         string type       = particle.type.ToString();
         int    poolAmount = particle.characteristics.warmPoolAmount;
         _particlePool.InitPool(type, poolAmount, particle.particlePrefab);
     }
 }
Пример #4
0
    public void Init()
    {
        GameObject pool = GameObject.FindGameObjectWithTag("ScenePool");

        if (!pool)
        {
            Debug.LogError("NO SCENE POOL TRANSFORM FOUND IN SCENE");
        }
        _enemyPool = new GenericPooler(pool.transform);
        _enemyPool.InitPool(ENEMY, 0, _gameplayResources.basicEnemyView);
    }