private void CalculateMultipliedCash() { var baseCash = FloorDataManager.BaseCashOfFloor(_floor.Id); var lvlMultiplier = FloorDataManager.MultiplierOfLevel(_floor.Level); var expMultiplier = _floor.Level != 1 ? _floor.Level * FloorDataManager.FLOOR_MAX_EXP + _floor.Exp : _floor.Exp; var cash = baseCash * lvlMultiplier * expMultiplier; MdlPlayer.AddCash(cash); _owner.RebuildWidgets(); //RebuildWidget(); }
private void RebuildWidget() //call each time when widget data changes to draw new info { var baseCash = FloorDataManager.BaseCashOfFloor(_floor.Id); var multiplier = FloorDataManager.MultiplierOfLevel(_floor.Level); var expMultiplier = _floor.Level != 1 ? _floor.Level * FloorDataManager.FLOOR_MAX_EXP + _floor.Exp : _floor.Exp; //IncomeFromFloor.text = (baseCash * multiplier * expMultiplier).ToString(); IncomeFromFloor.text = FloorDataManager.CorrectCashName(baseCash * multiplier * expMultiplier); TimeToGetIncome.text = "/" + FloorDataManager.TimeToEarnOfFloor(_floor.Id).ToString() + "s"; ExpText.text = _floor.Exp.ToString(); //ExpUpgradeCost.text = FloorDataManager.GetFloorNextExpUpgradeCost(_floor).ToString(); ExpUpgradeCost.text = FloorDataManager.CorrectCashName(FloorDataManager.GetFloorNextExpUpgradeCost(_floor)); if (_floor.Id == 2) { Debug.Log(string.Format("Can i upgrade floor? {0}, my cash: {1}, need to upgrade: {2}", _canExpUp(), MdlPlayer.Cash, FloorDataManager.GetFloorNextExpUpgradeCost(_floor))); } UnlockFloorBtn.SetActive(_canExpUp()); UpgradeFloorExp.interactable = _canExpUp(); ExpProgress.fillAmount = 1 - (_floor.Exp / (float)FloorDataManager.FLOOR_MAX_EXP); UpdateStars(); GameManager.Inst.SaveData(); }