public void BuildRepairCostLayout(DysonSphere.DysonSphereSettings dysonSphereSettings) { EmptyRepairCostLayout(); int structurePointsMissing = Mathf.FloorToInt(dysonSphereSettings.maxStructurePoint - dysonSphereSettings.currentStructurePoints); //Debug.Log("BuildRepairCostLayout | Structure Points missing [" + structurePointsMissing +"]"); if (structurePointsMissing > 0) { foreach (ResourcesManager.ResourceAmount resourceAmount in DysonSphere.instance.resourceCostPerStructurePointRepair) { //Debug.Log("BuildRepairCostLayout | Resource [" + resourceAmount.resourceType.resourceName + "] | Amount [" + resourceAmount.amount + "]"); // UI GameObject instantiatedResourceCostPanel = Instantiate(repairCostPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity); instantiatedResourceCostPanel.transform.SetParent(repairCostLayout.transform, false); // Multiply resourceAmount amount by StructurePointsMissing ResourcesManager.ResourceAmount multipliedResourceAmount = new ResourcesManager.ResourceAmount(resourceAmount.resourceType, resourceAmount.amount * structurePointsMissing); instantiatedResourceCostPanel.GetComponent <ResourceCostPanel>().SetInfo(multipliedResourceAmount); repairCostIndicators.Add(instantiatedResourceCostPanel); } } }
public void DisplayInfo(DysonSphere.DysonSphereSettings dysonSphereSettings) { // Energy / Structure points currentEnergyProductionText.text = Mathf.RoundToInt(dysonSphereSettings.energyProduction).ToString(); currentStructurePointsText.text = Mathf.RoundToInt(dysonSphereSettings.currentStructurePoints).ToString(); maxStructurePointsText.text = Mathf.RoundToInt(dysonSphereSettings.maxStructurePoint).ToString(); // Auto Repair State SetAutoRepairSwitch(dysonSphereSettings.currentAutoRepairState); BuildRepairCostLayout(dysonSphereSettings); }
public void ReceiveSettings(DysonSphere.DysonSphereSettings dysonSphereSettings) { DisplayInfo(dysonSphereSettings); }