71 lines
1.8 KiB
C#
71 lines
1.8 KiB
C#
using Bootstrap;
|
|
using Cinematics;
|
|
using UnityEngine;
|
|
using Core;
|
|
using System;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Playables;
|
|
using Core.Lifecycle;
|
|
|
|
public class PlayerHudManager : ManagedBehaviour
|
|
{
|
|
private AppSwitcher _appSwitcher;
|
|
public GameObject landscapeObject;
|
|
public GameObject portraitObject;
|
|
public GameObject cinematicsParentObject;
|
|
public GameObject CinematicBackground;
|
|
|
|
[HideInInspector] public Image cinematicSprites;
|
|
[HideInInspector] public Image cinematicBackgroundSprites;
|
|
|
|
[HideInInspector] public GameObject currentCinematicPlayer;
|
|
|
|
[HideInInspector] public PlayableDirector playableDirector;
|
|
|
|
|
|
|
|
private static PlayerHudManager _instance;
|
|
|
|
|
|
public static PlayerHudManager Instance => _instance;
|
|
private new void Awake()
|
|
{
|
|
if (Instance != null)
|
|
{
|
|
Destroy(this);
|
|
return;
|
|
}
|
|
|
|
_instance = this;
|
|
|
|
InitializeReferences();
|
|
}
|
|
|
|
private void InitializeReferences()
|
|
{
|
|
currentCinematicPlayer = landscapeObject;
|
|
playableDirector = cinematicsParentObject.GetComponent<PlayableDirector>();
|
|
cinematicSprites = currentCinematicPlayer.GetComponent<Image>();
|
|
cinematicBackgroundSprites = CinematicBackground.GetComponent<Image>();
|
|
}
|
|
|
|
private void UpateCinematicReferences(GameObject newCinematicPlayer)
|
|
{
|
|
currentCinematicPlayer = newCinematicPlayer;
|
|
cinematicSprites = currentCinematicPlayer.GetComponent<Image>();
|
|
}
|
|
|
|
public void SetPortraitMode(bool portraitModeEnable)
|
|
{
|
|
if (portraitModeEnable)
|
|
{
|
|
UpateCinematicReferences(portraitObject);
|
|
|
|
}
|
|
else
|
|
{
|
|
UpateCinematicReferences(landscapeObject);
|
|
}
|
|
}
|
|
}
|