Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
NorGateElectricElement.cs
浏览该文件的文档.
1namespace Game {
3 public float m_voltage;
4
5 public NorGateElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace) : base(subsystemElectricity, cellFace) { }
6
7 public override float GetOutputVoltage(int face) => m_voltage;
8
9 public override bool Simulate() {
10 float voltage = m_voltage;
11 int num = 0;
12 foreach (ElectricConnection connection in Connections) {
13 if (connection.ConnectorType != ElectricConnectorType.Output
14 && connection.NeighborConnectorType != 0) {
15 num |= (int)MathF.Round(connection.NeighborElectricElement.GetOutputVoltage(connection.NeighborConnectorFace) * 15f);
16 }
17 }
18 m_voltage = (~num & 0xF) / 15f;
19 return m_voltage != voltage;
20 }
21 }
22}
ElectricConnectorType ConnectorType
ElectricConnectorType NeighborConnectorType
virtual float GetOutputVoltage(int face)
List< ElectricConnection > Connections
override float GetOutputVoltage(int face)
NorGateElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace)
RotateableElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace)