Пример #1
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);
        }
Пример #2
0
        public BuildingSystem(GameConfig gameConfig, InventorySystem inventorySystem)
        {
            _inventorySystem = inventorySystem;
            _buildConfig     = gameConfig.bulidConfig;
            _buildables      = _buildConfig.buildables;

            // TODO: Klean it up!
            _dispatcher = Singleton.instance.notificationDispatcher;
            _dispatcher.AddListener(GameplayEventType.INVENTORY_UPDATED, onInventoryUpdated);
        }
Пример #3
0
    public EnemySystem(
        GameplayResources gameplayResources,
        GameConfig gameConfig,
        PlayerCombatSystem playerCombatSystem)
    {
        _gameplayResources = gameplayResources;
        _gameConfig        = gameConfig;

        _enemyDef = _gameConfig.enemyConfig.basicEnemy;

        _dispatcher = Singleton.instance.notificationDispatcher;
        _dispatcher.AddListener(GameplayEventType.ENEMY_KILLED, OnEnemyDestroyed);
    }