-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
49 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using KSP.UI.Screens.Flight; | ||
using UnityEngine; | ||
|
||
namespace CriticalTemperatureGauge | ||
{ | ||
public class Altimeter | ||
{ | ||
public Altimeter() | ||
{ | ||
var altitudeTumbler = GameObject.FindObjectOfType<KSP.UI.Screens.Flight.AltitudeTumbler>(); | ||
_altimeterPanel = altitudeTumbler.gameObject.transform.parent.parent.gameObject; | ||
_screenCenter = Screen.width / 2f; | ||
} | ||
|
||
public float Scale => _altimeterPanel.transform.lossyScale.y; | ||
|
||
public Vector2 DockPosition | ||
{ | ||
get | ||
{ | ||
var position = _altimeterPanel.transform.position; | ||
var x = ShiftX + position.x; | ||
var y = ShiftY - position.y + (Height - Margin) * Scale; | ||
return new Vector2(x, y); | ||
} | ||
} | ||
|
||
readonly GameObject _altimeterPanel; | ||
readonly float _screenCenter; | ||
|
||
const float ShiftX = 840; | ||
const float ShiftY = 525; | ||
const float Height = 82.5f; | ||
const float Margin = 8.5f; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+512 Bytes
(100%)
GameData/CriticalTemperatureGauge/Plugins/CriticalTemperatureGauge.dll
Binary file not shown.