public override void OnAdded() { CellFace cellFace = base.CellFaces[0]; int data = Terrain.ExtractData(base.SubsystemElectricity.SubsystemTerrain.Terrain.GetCellValue(cellFace.X, cellFace.Y, cellFace.Z)); int mountingFace = FourLedBlock.GetMountingFace(data); m_color = LedBlock.LedColors[FourLedBlock.GetColor(data)]; for (int i = 0; i < 4; i++) { int num = (i % 2 == 0) ? 1 : (-1); int num2 = (i / 2 == 0) ? 1 : (-1); Vector3 v = new Vector3((float)cellFace.X + 0.5f, (float)cellFace.Y + 0.5f, (float)cellFace.Z + 0.5f); Vector3 vector = CellFace.FaceToVector3(mountingFace); Vector3 vector2 = (mountingFace < 4) ? Vector3.UnitY : Vector3.UnitX; Vector3 vector3 = Vector3.Cross(vector, vector2); m_glowPoints[i] = m_subsystemGlow.AddGlowPoint(); m_glowPoints[i].Position = v - 0.4375f * CellFace.FaceToVector3(mountingFace) + 0.25f * vector3 * num + 0.25f * vector2 * num2; m_glowPoints[i].Forward = vector; m_glowPoints[i].Up = vector2; m_glowPoints[i].Right = vector3; m_glowPoints[i].Color = Color.Transparent; m_glowPoints[i].Size = 0.26f; m_glowPoints[i].FarSize = 0.26f; m_glowPoints[i].FarDistance = 1f; m_glowPoints[i].Type = GlowPointType.Square; } }
public override void OnAdded() { CellFace cellFace = base.CellFaces[0]; int data = Terrain.ExtractData(base.SubsystemElectricity.SubsystemTerrain.Terrain.GetCellValue(cellFace.X, cellFace.Y, cellFace.Z)); int mountingFace = FourLedBlock.GetMountingFace(data); m_color = LedBlock.LedColors[FourLedBlock.GetColor(data)]; Vector3 v = new Vector3((float)cellFace.X + 0.5f, (float)cellFace.Y + 0.5f, (float)cellFace.Z + 0.5f); Vector3 vector = CellFace.FaceToVector3(mountingFace); Vector3 vector2 = (mountingFace < 4) ? Vector3.UnitY : Vector3.UnitX; Vector3 right = Vector3.Cross(vector, vector2); m_glowPoint = m_subsystemGlow.AddGlowPoint(); m_glowPoint.Position = v - 0.4375f * CellFace.FaceToVector3(mountingFace); m_glowPoint.Forward = vector; m_glowPoint.Up = vector2; m_glowPoint.Right = right; m_glowPoint.Color = Color.Transparent; m_glowPoint.Size = 0.52f; m_glowPoint.FarSize = 0.52f; m_glowPoint.FarDistance = 1f; m_glowPoint.Type = GlowPointType.Square; }