/// <summary> /// Iterate on all the Occupied cells of a Cell. Here we can each Parent Occupied Rect cell. /// </summary> /// <param name="compAirFlow">The Object under scan</param> /// <param name="gridId">Grid ID of the current Network</param> /// <param name="flowIndex">Type of Air Flow</param> /// <param name="network">The Air Flow Network Object</param> private void ParseParentCell(CompAirFlow compAirFlow, int gridId, int flowIndex, AirFlowNet network) { foreach (var current in compAirFlow.parent.OccupiedRect().EdgeCells) { ScanCell(current, gridId, flowIndex, network); } }
/// <summary> /// Remove a Pipe from the Manager /// </summary> /// <param name="pipe">The Pipe's AirFlow Component</param> public void DeregisterPipe(CompAirFlow pipe) { if (CachedPipes.Contains(pipe)) { CachedPipes.Remove(pipe); CachedPipes.Shuffle(); } DirtyPipeGrid(); }
/// <summary> /// Register a Pipe to the Manager /// </summary> /// <param name="pipe">A Pipe's AirFlow Component</param> public void RegisterPipe(CompAirFlow pipe) { if (!CachedPipes.Contains(pipe)) { CachedPipes.Add(pipe); CachedPipes.Shuffle(); } DirtyPipeGrid(); }
/// <summary> /// Remove a Pipe from the Manager /// </summary> /// <param name="pipe">The Pipe's AirFlow Component</param> public void DeregisterPipe(CompAirFlow pipe) { if (CachedPipes.Contains(pipe)) { CachedPipes.Remove(pipe); CachedPipes.Shuffle(); // ! Why Shuffle? --Brain } // Useless function call --Brain // DirtyPipeGrid(); IsDirty = true; }
/// <summary> /// Validate Building as Climate Control Building /// </summary> /// <param name="compAirFlow">Building Component</param> /// <param name="network">Current Network</param> private static void ValidateAsTempControl(CompAirFlow compAirFlow, AirFlowNet network) { var tempControl = compAirFlow as CompAirFlowTempControl; if (tempControl == null) { return; } if (!network.TempControls.Contains(tempControl)) { network.TempControls.Add(tempControl); } tempControl.AirFlowNet = network; }
/// <summary> /// Validate Building as Air Flow Producer /// </summary> /// <param name="compAirFlow">Building Component</param> /// <param name="network">Current Network</param> private static void ValidateAsProducer(CompAirFlow compAirFlow, AirFlowNet network) { var producer = compAirFlow as CompAirFlowProducer; if (producer == null) { return; } if (!network.Producers.Contains(producer)) { network.Producers.Add(producer); } producer.AirFlowNet = network; }
/// <summary> /// Validate as a Air Flow Consumer /// </summary> /// <param name="compAirFlow">Building Component</param> /// <param name="network">Current Network</param> private static void ValidateAsConsumer(CompAirFlow compAirFlow, AirFlowNet network) { var consumer = compAirFlow as CompAirFlowConsumer; if (consumer == null) { return; } if (!network.Consumers.Contains(consumer)) { network.Consumers.Add(consumer); } consumer.AirFlowNet = network; }
/// <summary> /// Check Building Priority. If the Building is a Consumer, we can check for Priority. /// If the Priority is Auto, then we skip the priority check /// else we check if the Network air type matches the Priority. If it does match we add it to the network. Else we skip it. /// </summary> /// <param name="compAirFlow">Building Component</param> /// <param name="network">Current Network</param> /// <returns>Result if we can add the Building to existing Network</returns> private static bool ValidateBuildingPriority(CompAirFlow compAirFlow, AirFlowNet network) { if (compAirFlow == null) { return(false); } var consumer = compAirFlow as CompAirFlowConsumer; if (consumer == null) { return(true); } var priority = consumer.AirTypePriority; if (priority == AirTypePriority.Auto) { return(true); } return((int)priority == (int)network.FlowType); }
/// <summary> /// Validate a Building. Check if it is a Consumer, Producer or Climate Control. If so, Add it to the network. /// </summary> /// <param name="compAirFlow">Building Component</param> /// <param name="network">Current Network</param> private static void ValidateBuilding(CompAirFlow compAirFlow, AirFlowNet network) { ValidateAsProducer(compAirFlow, network); ValidateAsTempControl(compAirFlow, network); ValidateAsConsumer(compAirFlow, network); }