//Bring the cursor back and freeze the player public void Sell() { if (_currentObject == null) { return; } _credits += _currentObject.GetPrice(); _currentObject.TurnIntoEmpty(); ReturnPlayerControl(); _currentObject = null; _uiManager.ClosePopUp(); _audioSource.PlayOneShot(_SfxSell); }
public void SetUpPopUp(PurchasableObject _object) { if (_object.tag == "EmptyObject") { MainText.text = _object.buyText + " Buy it for " + _object.GetPrice() + " neurons?"; BuyButton.gameObject.SetActive(true); SellButton.gameObject.SetActive(false); } else { MainText.text = _object.sellText + " Sell it for " + _object.GetPrice() + " neurons?"; BuyButton.gameObject.SetActive(false); SellButton.gameObject.SetActive(true); } }
//Bring the cursor back and freeze the player public void Buy() { if (_currentObject == null) { return; } if (_credits - _currentObject.GetPrice() < 0) { _uiManager.OutOfCash(); _currentObject = null; _audioSource.PlayOneShot(_SfxDenied); return; } _audioSource.PlayOneShot(_SfxBuy); _uiManager.ClosePopUp(); _credits -= _currentObject.GetPrice(); _currentObject.TurnIntoObject(); ReturnPlayerControl(); _currentObject = null; }
//Sets object selected public void SetCurrentObject(PurchasableObject purchasableObject) { _currentObject = purchasableObject; }