Beispiel #1
0
 public void AddExp()
 {
     MdlPlayer.AddCash(-FloorDataManager.GetFloorNextExpUpgradeCost(this));
     Exp++;
     if (Exp >= FloorDataManager.FLOOR_MAX_EXP)
     {
         AddLvl();
         Exp = 0;
     }
 }
Beispiel #2
0
 public void Init(MdlFloor floor, UIFloorsPanel owner)
 {
     _owner               = owner;
     _floor               = floor;
     BtnGetIncome         = BtnGetIncome.GetComponent <Button>();
     UpgradeFloorExp      = UpgradeFloorExp.GetComponent <Button>();
     _owner.OnCashUpdate += RebuildWidget;
     //CostToOpen.text = FloorDataManager.GetFloorNextExpUpgradeCost(_floor).ToString();
     //CostToOpenInactive.text = FloorDataManager.GetFloorNextExpUpgradeCost(_floor).ToString();
     CostToOpen.text         = FloorDataManager.CorrectCashName(FloorDataManager.GetFloorNextExpUpgradeCost(_floor));
     CostToOpenInactive.text = CostToOpen.text;
     OpenFloor();
     RebuildWidget();
     if (_hasHelper())
     {
         GetCash();
     }
 }
Beispiel #3
0
    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();
    }
Beispiel #4
0
 private bool _canExpUp()
 {
     return(MdlPlayer.Cash >= FloorDataManager.GetFloorNextExpUpgradeCost(_floor));
 }