public static void AddSupply(PowerSupplyControlInheritance Supply, PowerTypeCategory category) { if (!(AliveSupplies.ContainsKey(category))) { AliveSupplies[category] = new HashSet <PowerSupplyControlInheritance>(); } AliveSupplies[category].Add(Supply); TotalSupplies.Add(Supply); }
public static void AddSupply(ElectricalNodeControl Supply, PowerTypeCategory category) { if (!(AliveSupplies.ContainsKey(category))) { AliveSupplies[category] = new HashSet <ElectricalNodeControl>(); } AliveSupplies[category].Add(Supply); TotalSupplies.Add(Supply); }
public void OverlayInternalResistance(float InternalResistance, PowerTypeCategory Connecting) { if (Node.InData.ConnectionReaction.TryGetValue(Connecting, out PowerInputReactions connReact) && !ResistanceRestorepoints.ContainsKey(Connecting)) { ResistanceRestorepoints[Connecting] = connReact.ResistanceReactionA.Resistance.Ohms; connReact.ResistanceReactionA.Resistance.Ohms = InternalResistance; } ElectricalManager.Instance.electricalSync.InitialiseResistanceChange.Add(this); }
public void OverlayInternalResistance(float InternalResistance, PowerTypeCategory Connecting) { if (Node.InData.ConnectionReaction.ContainsKey(Connecting) && (!(ResistanceRestorepoints.ContainsKey(Connecting)))) { ResistanceRestorepoints[Connecting] = Node.InData.ConnectionReaction[Connecting].ResistanceReactionA.Resistance.Ohms; Node.InData.ConnectionReaction[Connecting].ResistanceReactionA.Resistance.Ohms = InternalResistance; } ElectricalSynchronisation.InitialiseResistanceChange.Add(this); }
public void AddSupply(ElectricalNodeControl supply, PowerTypeCategory category) { var adding = new QueueAddSupply() { category = category, supply = supply }; SupplyToadd.Add(adding); }
public void SetUp(IntrinsicElectronicData indata) { Categorytype = indata.Categorytype; ConnectionReaction = indata.ConnectionReaction; Present = indata.Present; MetaDataPresent = indata.MetaDataPresent; CanConnectTo = indata.CanConnectTo; WireEndB = indata.WireEndB; WireEndA = indata.WireEndA; }
private void UnderFloorElectricalSetTile(Connection WireEndA, Connection WireEndB, PowerTypeCategory powerTypeCategory, Vector3Int position, ElectricalMetaData newdata = null) { ElectricalCableTile Tile = ElectricityFunctions.RetrieveElectricalTile(WireEndA, WireEndB, powerTypeCategory); if (newdata != null) { newdata.RelatedTile = Tile; } if (Tile != null) { AddUnderFloorTile(position, Tile, Matrix4x4.identity, Color.white); } }
public static float WorkOutVoltageFromConnector(ElectricalOIinheritance ElectricItem, PowerTypeCategory SpecifiedDevice) { float Voltage = 0; foreach (var Supply in ElectricItem.InData.Data.SupplyDependent) { bool pass = false; foreach (var subcheck in Supply.Value.CurrentComingFrom) { if (subcheck.Key.Categorytype == SpecifiedDevice) { pass = true; break; } } if (!pass) { foreach (var subcheck in Supply.Value.CurrentGoingTo) { if (subcheck.Key.Categorytype == SpecifiedDevice) { pass = true; break; } } } if (pass) { Voltage += Supply.Value.SourceVoltage; } } return(Voltage); }
public static ElectricalCableTile RetrieveElectricalTile(Connection WireEndA, Connection WireEndB, PowerTypeCategory powerTypeCategory) { ElectricalCableTile Tile = null; int spriteIndex = WireDirections.GetSpriteIndex(WireEndA, WireEndB); switch (powerTypeCategory) { case PowerTypeCategory.StandardCable: { Tile = ElectricalManager.Instance.MediumVoltageCables.Tiles[spriteIndex]; break; } case PowerTypeCategory.LowVoltageCable: { Tile = ElectricalManager.Instance.LowVoltageCables.Tiles[spriteIndex]; break; } case PowerTypeCategory.HighVoltageCable: { Tile = ElectricalManager.Instance.HighVoltageCables.Tiles[spriteIndex]; break; } } return(Tile); }
public void SetDeadEnd() { Categorytype = PowerTypeCategory.DeadEndConnection; }
public static float WorkOutVoltageNOTFromConnector(ElectricalOIinheritance ElectricItem, PowerTypeCategory SpecifiedDevice) { float Voltage = 0; foreach (var Supply in ElectricItem.Data.SupplyDependent) { bool pass = true; foreach (var subcheck in Supply.Value.Upstream) { if (subcheck.InData.Categorytype == SpecifiedDevice) { pass = false; } } if (pass) { Voltage += Supply.Value.SourceVoltages; } } return(Voltage); }
public static ElectricalCableTile RetrieveElectricalTile(Connection WireEndA, Connection WireEndB, PowerTypeCategory powerTypeCategory) { ElectricalCableTile Tile = null; string Compound; if (WireEndA < WireEndB) { Compound = WireEndA + "_" + WireEndB; } else { Compound = WireEndB + "_" + WireEndA; } int spriteIndex = WireDirections.GetSpriteIndex(Compound); switch (powerTypeCategory) { case PowerTypeCategory.StandardCable: Tile = ElectricalManager.Instance.MediumVoltageCables.Tiles[spriteIndex]; break; case PowerTypeCategory.LowVoltageCable: Tile = ElectricalManager.Instance.LowVoltageCables.Tiles[spriteIndex]; break; case PowerTypeCategory.HighVoltageCable: Tile = ElectricalManager.Instance.HighVoltageCables.Tiles[spriteIndex]; break; } return(Tile); }
private void UnderFloorElectricalSetTile(Connection WireEndA, Connection WireEndB, PowerTypeCategory powerTypeCategory, Vector3Int position, ElectricalMetaData newdata = null) { ElectricalCableTile Tile = ElectricityFunctions.RetrieveElectricalTile(WireEndA, WireEndB, powerTypeCategory); if (newdata != null) { newdata.RelatedTile = Tile; } if (Tile != null) { if (UnderFloorLayer == null) { underFloorLayer = GetComponentInChildren <UnderFloorLayer>(); } if (UnderFloorLayer != null) { UnderFloorLayer.SetTile(position, Tile, Matrix4x4.identity); } } }