mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fixed #393
This commit is contained in:
parent
24eedc887a
commit
70467b76a1
@ -19,24 +19,31 @@ namespace NewHorizons.Utility.DebugUtilities
|
|||||||
|
|
||||||
private ScreenPrompt _raycastPrompt;
|
private ScreenPrompt _raycastPrompt;
|
||||||
|
|
||||||
private void Awake()
|
private void Start()
|
||||||
{
|
{
|
||||||
_rb = this.GetRequiredComponent<OWRigidbody>();
|
_rb = this.GetRequiredComponent<OWRigidbody>();
|
||||||
|
|
||||||
_raycastPrompt = new ScreenPrompt(TranslationHandler.GetTranslation("DEBUG_RAYCAST", TranslationHandler.TextType.UI) + " <CMD>", ImageUtilities.GetButtonSprite(KeyCode.P));
|
if (_raycastPrompt == null)
|
||||||
|
{
|
||||||
Locator.GetPromptManager().AddScreenPrompt(_raycastPrompt, PromptPosition.UpperRight, false);
|
_raycastPrompt = new ScreenPrompt(TranslationHandler.GetTranslation("DEBUG_RAYCAST", TranslationHandler.TextType.UI) + " <CMD>", ImageUtilities.GetButtonSprite(KeyCode.P));
|
||||||
|
Locator.GetPromptManager().AddScreenPrompt(_raycastPrompt, PromptPosition.UpperRight, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
Locator.GetPromptManager()?.RemoveScreenPrompt(_raycastPrompt, PromptPosition.UpperRight);
|
if (_raycastPrompt != null)
|
||||||
|
{
|
||||||
|
Locator.GetPromptManager()?.RemoveScreenPrompt(_raycastPrompt, PromptPosition.UpperRight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
UpdatePromptVisibility();
|
UpdatePromptVisibility();
|
||||||
|
|
||||||
if (!Main.Debug) return;
|
if (!Main.Debug) return;
|
||||||
|
|
||||||
if (Keyboard.current == null) return;
|
if (Keyboard.current == null) return;
|
||||||
|
|
||||||
if (Keyboard.current[Key.P].wasReleasedThisFrame)
|
if (Keyboard.current[Key.P].wasReleasedThisFrame)
|
||||||
@ -48,7 +55,10 @@ namespace NewHorizons.Utility.DebugUtilities
|
|||||||
|
|
||||||
public void UpdatePromptVisibility()
|
public void UpdatePromptVisibility()
|
||||||
{
|
{
|
||||||
_raycastPrompt.SetVisibility(!OWTime.IsPaused() && Main.Debug);
|
if (_raycastPrompt != null)
|
||||||
|
{
|
||||||
|
_raycastPrompt.SetVisibility(!OWTime.IsPaused() && Main.Debug);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user