//Called at the start of the level protected virtual void Start() { myInstance = this; //Create the lists activeObjects = new List <ObjectBase>(); BackPackItemTypes = new List <BackPackItemType>(); //Loop trough the active objects and add them to the active list, if they have an ObjectBase component foreach (Transform item in activeContainer) { if (item.GetComponent <ObjectBase>()) { activeObjects.Add(item.GetComponent <ObjectBase>()); item.GetComponent <ObjectBase>().Setup(); } } //Loop trough the BackPack objects and add them to the BackPack list foreach (Transform item in BackPackContainer) { item.GetComponent <BackPackItemType>(); BackPackItemTypes.Add(item.GetComponent <BackPackItemType>()); } //And send them to the BackPack manager BackPackManager.Instance.SetupToolbar(BackPackItemTypes); }
public void SetUp(GameInputManager gameInputManager, GameUnitManager gameUnitManager, LevelDesignManager levelDesign, MapGrid mapGrid, MapBlockManager mapBlockManager, STPTheme stpTheme, StatsHolder statHolder) { _gameInputManager = gameInputManager; _gameInputManager.OnSelectTileNode += SelectTileListener; _gameUnitManager = gameUnitManager; _levelDesignManager = levelDesign; _mapGrid = mapGrid; _mapBlockManager = mapBlockManager; _stpTheme = stpTheme; _statHolder = statHolder; if (ConstructionUI != null) { ConstructionUI.TowerClickEvent += SelectTowerToBuild; } }
private void Awake() { var monsterPools = statsHolder.FindObjectByType <MonsterStats>(); _blockManager = GetComponentInChildren <MapBlockManager>(); _mapGrid = GetComponentInChildren <MapGrid>(); _gameInputManager = GetComponentInChildren <GameInputManager>(); _gameInteractorCtrl = GetComponentInChildren <InGameUICtrl>(); _poolManager = GetComponentInChildren <PoolManager>(); _gameUnitManager = GetComponentInChildren <GameUnitManager>(); _levelDesignManager = GetComponentInChildren <LevelDesignManager>(); _headView = GetComponentInChildren <HeaderView>(); _mapBlockBottomView = GetComponentInChildren <MapBlockBottomView>(); _mapGrid.SetUp(); _gameInputManager.SetUp(_mapGrid, _blockManager); _gameUnitManager.SetUp(_blockManager, _mapGrid, poolingTheme.total); _levelDesignManager.Init(_gameUnitManager, _blockManager, _mapGrid, monsterPools); _gameInteractorCtrl.SetUp(_gameInputManager, _gameUnitManager, _levelDesignManager, _mapGrid, _blockManager, poolingTheme, statsHolder); }
private void Awake() { instance = this; }
//Called at the start of the level protected virtual void Start() { myInstance = this; //Create the lists activeObjects = new List<ObjectBase>(); BackPackItemTypes = new List<BackPackItemType>(); //Loop trough the active objects and add them to the active list, if they have an ObjectBase component foreach (Transform item in activeContainer) { if (item.GetComponent<ObjectBase>()) { activeObjects.Add(item.GetComponent<ObjectBase>()); item.GetComponent<ObjectBase>().Setup(); } } //Loop trough the BackPack objects and add them to the BackPack list foreach (Transform item in BackPackContainer) { item.GetComponent<BackPackItemType>(); BackPackItemTypes.Add(item.GetComponent<BackPackItemType>()); } //And send them to the BackPack manager BackPackManager.Instance.SetupToolbar(BackPackItemTypes); }