/// <returns> The previous level </returns> public BuildingDescription Upgrade(PlayerBuildingType type) { var prev = upgradeChain[type]; upgradeChain[type] = prev.nextLevel; return(prev); }
public void SetDisplay(PlayerBuildingType type, Vector2 basePosition) { var sobj = BuildingLevels.Instance.GetCurrLevel(type); typeText.text = $"{sobj.readableName} - {sobj.level} 级"; productText.text = $"人口:{sobj.product[PropertyType.Population]} 资产:{sobj.product[PropertyType.Finance]}"; costText.text = $"人口:{sobj.buildCost[PropertyType.Population]} 资产:{sobj.buildCost[PropertyType.Finance]}"; lockedText.enabled = !sobj.Unlocked; Debug.Log($"BA: {basePosition}"); transform.position = basePosition - new Vector2(LeftOffset, 0); gameObject.SetActive(true); }
public bool HasNextLevel(PlayerBuildingType type) { return(upgradeChain[type].nextLevel != null); }
//public int GetCurrLevel(BuildingType type) { // var sobj = upgradeChain[type]; // if(sobj.Unlocked) // return sobj.level; // return sobj.level - 1; //} public BuildingDescription GetCurrLevel(PlayerBuildingType type) { return(upgradeChain[type]); }