Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
PhotodiodeElectricElement.cs
浏览该文件的文档.
1using Engine;
2
3namespace Game {
5 public float m_voltage;
6
7 public PhotodiodeElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace) : base(subsystemElectricity, cellFace) =>
9
10 public override float GetOutputVoltage(int face) => m_voltage;
11
12 public override bool Simulate() {
13 float voltage = m_voltage;
16 return m_voltage != voltage;
17 }
18
19 public float CalculateVoltage() {
20 CellFace cellFace = CellFaces[0];
21 Point3 point = CellFace.FaceToPoint3(cellFace.Face);
22 int cellLight = SubsystemElectricity.SubsystemTerrain.Terrain.GetCellLight(cellFace.X, cellFace.Y, cellFace.Z);
24 cellFace.X + point.X,
25 cellFace.Y + point.Y,
26 cellFace.Z + point.Z
27 );
28 return MathUtils.Max(cellLight, cellLight2) / 15f;
29 }
30 }
31}
static int Max(int x1, int x2)
ReadOnlyList< CellFace > CellFaces
MountedElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace)
PhotodiodeElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace) override float GetOutputVoltage(int face)
void QueueElectricElementForSimulation(ElectricElement electricElement, int circuitStep)
virtual int GetCellLight(int x, int y, int z)
static Point3 FaceToPoint3(int face)