public void UpgradeActor() { _actor.LevelUp(FinanceManager.Settings); FinanceManager.UpdateMoney(-_price); _price *= FinanceManager.Settings.ActorUpgradePriceIncrement; UpdateUI(); _purchaseButton.interactable = _price <= FinanceManager.TotalMoney; _upgradeAmount.text = Mathf.Round(_price).ToString(); _capacityAmount.text = Mathf.Round(_actor.Settings.Skill * _actor.SkillMultiplier).ToString(); if (gameObject.tag == "Warehouse") { GameSaveDataController.SetWarehouseState(); } else if (gameObject.tag == "Elevator") { GameSaveDataController.SetElevatorState(); } else if (GetGrandparentTag(this.transform) == "Shaft") { Shaft shaft = transform.parent.GetComponentInParent <Shaft>(); if (shaft != null) { GameSaveDataController.SetShaftState(shaft); } } }
public void BuildNextShaft() { var position = mine.shafts[mine.shafts.Count - 1].NextShaftTransform.position; var newObject = Instantiate(shaftPrefab, position, Quaternion.identity); var shaft = newObject.GetComponent <Shaft>(); shaft.name += mine.shafts.Count.ToString(); mine.shafts.Add(shaft); shaft.ShaftManager = this; shaft.Initialize(elevator, mine.GetFinanceManager(), mine.shafts.Count); mine.GetFinanceManager().UpdateMoney(-mine.GetFinanceManager().NextShaftPrice); mine.GetFinanceManager().NextShaftPrice *= settings.ShaftIncrement; GameSaveDataController.SetShaftState(shaft); }