/** * Calculates the total cost and R value given all the objects currently enabled in the scene. */ void CalculateCostAndR() { float newCost = 0f; float newR = 0f; foreach (var obj in objDict) { if (obj.Value) { TagObject tagObj = descriptions.GetStructByTag(obj.Key.tag); newCost += tagObj.cost; newR += tagObj.rVal; } } totalCost = newCost; totalR = newR; MainUIController(); }