public void BuildSelectedItem() { _itemToBuild = _fabricatorSelection.SelectedFabricatorItem; if (!_itemToBuild) { return; } if (!CanBuild()) { //TODO: Handle not able to build. Red light or something? Debug.Log("Fabricator issue: can't build"); } else { _buildSecondsRemaining = _itemToBuild.SecondsTakenToBuild; //Start particles SetBuildEffectsEnabled(true); //Start animation //Charge currency wallet if (_currencyWallet) { _currencyWallet.RemoveCurrency(_itemToBuild.ItemPrice); } _currentlyBuilding = true; } }
protected override void OnBeginDrawEditors() { OdinMenuTreeSelection selected = this.MenuTree.Selection; SirenixEditorGUI.BeginHorizontalToolbar(); { GUILayout.FlexibleSpace(); if (SirenixEditorGUI.ToolbarButton("Delete Current")) { SOFabricatorItem asset = selected.SelectedValue as SOFabricatorItem; string path = AssetDatabase.GetAssetPath(asset); AssetDatabase.DeleteAsset(path); AssetDatabase.SaveAssets(); } } SirenixEditorGUI.EndHorizontalToolbar(); }
public void CancelBuild() { if (!_canCancelBuild) { return; } _currentlyBuilding = false; _buildSecondsRemaining = -1; //Disable build effects. SetBuildEffectsEnabled(false); //Refund cost if (_currencyWallet) { _currencyWallet.AddCurrency(_itemToBuild.ItemPrice); } _itemToBuild = null; }
void SetActiveSelection(int idx) { if (idx >= _possibleItems.Count) { idx = 0; } else if (idx < 0) { idx = _possibleItems.Count - 1; } SelectedIndex = idx; SOFabricatorItem item = _possibleItems[SelectedIndex]; _itemNameUIText.text = item.ItemName; _itemPriceUIText.text = item.ItemPrice.ToString(); _itemDescUIText.text = item.ItemDescription; if (_itemIconUIImage && item.ItemFabricatorIcon) { _itemIconUIImage.sprite = item.ItemFabricatorIcon; } }