public void OnBuildTypeChange(Buildable.TYPE type) { if (_currentItem) { _currentItem.ToggleItem(false); } if (_buildItems.ContainsKey(type)) { _currentItem = _buildItems[type]; _currentItem.ToggleItem(true); } }
private void CreateBuildables() { BuildConfig.BuildableBlueprint[] blueprints = _buildConfig.buildables; BuildConfig.BuildUIData _uiData = _buildConfig._uiData; for (int i = 0; i < blueprints.Length; i++) { BuildConfig.BuildableBlueprint blueprint = blueprints[i]; BuildableUIItem uiItem = GameObject.Instantiate(_uiData._itemPrefabUI, _buildView._buildableParent.transform, false) as BuildableUIItem; uiItem.SetContent(blueprint, i); _buildItems[blueprint.key] = uiItem; } OnBuildTypeChange(_buildingSystem._currentBuildType); }