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