Exemplo n.º 1
0
        private void setBuildingDevicesCount(ConstructionNode node, int newBuildingDevicesCount)
        {
            var clockSpeedSum = 0.0;

            foreach (var device in node.buildingDevices)
            {
                clockSpeedSum = clockSpeedSum + device.getClockSpeed();
            }

            for (var i = node.buildingDevices.Count; i < newBuildingDevicesCount; i++)
            {
                node.addMachine();
            }

            node.updateBuildingDevicesClockSpeedAndAlignPowerUsage(clockSpeedSum / newBuildingDevicesCount);
        }
 public ConstructionTree(ConstructionNode root)
 {
     this.root   = root;
     ingredients = new List <ConstructionTree>();
 }