Cinematics and UI overhaul
This commit is contained in:
@@ -80,28 +80,30 @@ namespace Cinematics
|
||||
// Initialize PlayableDirector if not set
|
||||
if (playableDirector == null)
|
||||
{
|
||||
playableDirector = GetComponent<PlayableDirector>();
|
||||
playableDirector = PlayerHudManager.Instance.playableDirector;
|
||||
|
||||
// If still null, try to add the component
|
||||
if (playableDirector == null)
|
||||
{
|
||||
playableDirector = gameObject.AddComponent<PlayableDirector>();
|
||||
Debug.Log("[CinematicsManager] Added missing PlayableDirector component");
|
||||
Debug.Log("[CinematicsManager] Could not find Playable Director on the PlayerHudManager");
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize _cinematicSprites if not set
|
||||
if (_cinematicSprites == null)
|
||||
{
|
||||
// First try to find in children
|
||||
_cinematicSprites = GetComponentInChildren<Image>(true);
|
||||
// First try to find in children in the PlayerHud
|
||||
_cinematicSprites = PlayerHudManager.Instance.cinematicSprites;
|
||||
|
||||
// If still null, create a new UI Image for cinematics
|
||||
// If still null, return error
|
||||
if (_cinematicSprites == null)
|
||||
{
|
||||
Debug.LogWarning("[CinematicsManager] No Image found for cinematics display. Cinematics may not display correctly.");
|
||||
}
|
||||
}
|
||||
|
||||
cinematicSpritesGameObject = PlayerHudManager.Instance.currentCinematicPlayer;
|
||||
cinematicBackground = PlayerHudManager.Instance.CinematicBackground;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,6 +119,7 @@ namespace Cinematics
|
||||
_cinematicSprites.enabled = true;
|
||||
cinematicSpritesGameObject.SetActive(true);
|
||||
}
|
||||
cinematicBackground.SetActive(true);
|
||||
|
||||
playableDirector.stopped += OnPlayableDirectorStopped;
|
||||
playableDirector.Play(assetToPlay);
|
||||
@@ -141,7 +144,7 @@ namespace Cinematics
|
||||
/// <summary>
|
||||
/// Loads a playable from an asset path and plays it as a cinematic
|
||||
/// </summary>
|
||||
public PlayableDirector LoadAndPlayCinematic(string key)
|
||||
public PlayableDirector LoadAndPlayCinematic(string key, bool playPortraitMode)
|
||||
{
|
||||
// Load the asset via addressables
|
||||
var handle = Addressables.LoadAssetAsync<PlayableAsset>(key);
|
||||
@@ -152,6 +155,7 @@ namespace Cinematics
|
||||
|
||||
Logging.Debug($"[CinematicsManager] Loaded addressable cinematic: {key}");
|
||||
|
||||
PlayerHudManager.Instance.SetPortraitMode(playPortraitMode);
|
||||
return PlayCinematic(result);
|
||||
}
|
||||
|
||||
@@ -197,7 +201,7 @@ namespace Cinematics
|
||||
|
||||
public void ShowCinematicBackground(bool shouldBeActive)
|
||||
{
|
||||
cinematicBackground.SetActive(shouldBeActive);
|
||||
cinematicBackground.SetActive(shouldBeActive);
|
||||
}
|
||||
|
||||
public void ShowGameOverScreen()
|
||||
@@ -217,5 +221,12 @@ namespace Cinematics
|
||||
Logging.Warning("[CinematicsManager] DivingGameOverScreen reference is not set!");
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeCinematicBackgroundColour(Color clr)
|
||||
{
|
||||
PlayerHudManager.Instance.cinematicBackgroundSprites.color = clr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user