mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add game over text and death type to credits volume, but doesnt work
This commit is contained in:
parent
9080b45c14
commit
bd61a87cf6
@ -1,5 +1,6 @@
|
|||||||
using NewHorizons.Components.Volumes;
|
using NewHorizons.Components.Volumes;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
|
using OWML.Utils;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Volumes
|
namespace NewHorizons.Builder.Volumes
|
||||||
@ -11,6 +12,8 @@ namespace NewHorizons.Builder.Volumes
|
|||||||
var volume = VolumeBuilder.Make<LoadCreditsVolume>(planetGO, sector, info);
|
var volume = VolumeBuilder.Make<LoadCreditsVolume>(planetGO, sector, info);
|
||||||
|
|
||||||
volume.creditsType = info.creditsType;
|
volume.creditsType = info.creditsType;
|
||||||
|
volume.gameOverText = info.gameOverText;
|
||||||
|
volume.deathType = EnumUtils.Parse(info.deathType.ToString(), DeathType.Default);
|
||||||
|
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components.Volumes
|
namespace NewHorizons.Components.Volumes
|
||||||
@ -7,29 +9,74 @@ namespace NewHorizons.Components.Volumes
|
|||||||
{
|
{
|
||||||
public VolumesModule.LoadCreditsVolumeInfo.CreditsType creditsType = VolumesModule.LoadCreditsVolumeInfo.CreditsType.Fast;
|
public VolumesModule.LoadCreditsVolumeInfo.CreditsType creditsType = VolumesModule.LoadCreditsVolumeInfo.CreditsType.Fast;
|
||||||
|
|
||||||
|
public string gameOverText;
|
||||||
|
public DeathType deathType = DeathType.Default;
|
||||||
|
|
||||||
|
private GameOverController _gameOverController;
|
||||||
|
private PlayerCameraEffectController _playerCameraEffectController;
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
_gameOverController = GameObject.FindObjectOfType<GameOverController>();
|
||||||
|
_playerCameraEffectController = GameObject.FindObjectOfType<PlayerCameraEffectController>();
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnTriggerVolumeEntry(GameObject hitObj)
|
public override void OnTriggerVolumeEntry(GameObject hitObj)
|
||||||
{
|
{
|
||||||
if (hitObj.CompareTag("PlayerDetector") && enabled)
|
if (hitObj.CompareTag("PlayerDetector") && enabled)
|
||||||
{
|
{
|
||||||
switch(creditsType)
|
StartCoroutine(GameOver());
|
||||||
{
|
|
||||||
case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Fast:
|
|
||||||
LoadManager.LoadScene(OWScene.Credits_Fast, LoadManager.FadeType.ToBlack);
|
|
||||||
break;
|
|
||||||
case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Final:
|
|
||||||
LoadManager.LoadScene(OWScene.Credits_Final, LoadManager.FadeType.ToBlack);
|
|
||||||
break;
|
|
||||||
case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Kazoo:
|
|
||||||
TimelineObliterationController.s_hasRealityEnded = true;
|
|
||||||
LoadManager.LoadScene(OWScene.Credits_Fast, LoadManager.FadeType.ToBlack);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnTriggerVolumeExit(GameObject hitObj)
|
private IEnumerator GameOver()
|
||||||
{
|
{
|
||||||
|
OWInput.ChangeInputMode(InputMode.None);
|
||||||
|
ReticleController.Hide();
|
||||||
|
Locator.GetPromptManager().SetPromptsVisible(false);
|
||||||
|
Locator.GetPauseCommandListener().AddPauseCommandLock();
|
||||||
|
|
||||||
|
_playerCameraEffectController.OnPlayerDeath(deathType);
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(_playerCameraEffectController._deathFadeLength);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(gameOverText) && _gameOverController != null)
|
||||||
|
{
|
||||||
|
_gameOverController._deathText.text = TranslationHandler.GetTranslation(gameOverText, TranslationHandler.TextType.UI);
|
||||||
|
_gameOverController.SetupGameOverScreen(5f);
|
||||||
|
|
||||||
|
// We set this to true to stop it from loading the credits scene, so we can do it ourselves
|
||||||
|
_gameOverController._loading = true;
|
||||||
|
|
||||||
|
yield return new WaitUntil(ReadytoLoadCreditsScene);
|
||||||
|
|
||||||
|
LoadCreditsScene();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LoadCreditsScene();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ReadytoLoadCreditsScene() => _gameOverController._fadedOutText && _gameOverController._textAnimator.IsComplete();
|
||||||
|
|
||||||
|
public override void OnTriggerVolumeExit(GameObject hitObj) { }
|
||||||
|
|
||||||
|
private void LoadCreditsScene()
|
||||||
|
{
|
||||||
|
switch (creditsType)
|
||||||
|
{
|
||||||
|
case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Fast:
|
||||||
|
LoadManager.LoadScene(OWScene.Credits_Fast, LoadManager.FadeType.ToBlack);
|
||||||
|
break;
|
||||||
|
case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Final:
|
||||||
|
LoadManager.LoadScene(OWScene.Credits_Final, LoadManager.FadeType.ToBlack);
|
||||||
|
break;
|
||||||
|
case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Kazoo:
|
||||||
|
TimelineObliterationController.s_hasRealityEnded = true;
|
||||||
|
LoadManager.LoadScene(OWScene.Credits_Fast, LoadManager.FadeType.ToBlack);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
NewHorizons/External/Modules/VolumesModule.cs
vendored
10
NewHorizons/External/Modules/VolumesModule.cs
vendored
@ -171,6 +171,16 @@ namespace NewHorizons.External.Modules
|
|||||||
|
|
||||||
[DefaultValue("fast")]
|
[DefaultValue("fast")]
|
||||||
public CreditsType creditsType = CreditsType.Fast;
|
public CreditsType creditsType = CreditsType.Fast;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text displayed in orange on game over. For localization, put translations under UI.
|
||||||
|
/// </summary>
|
||||||
|
public string gameOverText;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The type of death the player will have if they enter this volume.
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue("default")] public DeathType deathType = DeathType.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user