add project files
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using UnityEngine;
|
||||
using OHM.UnityToolkit;
|
||||
using OHM.UnityToolkit.UI;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class UIGameOver : UIMenu
|
||||
{
|
||||
[SerializeField]
|
||||
private UIIncrementableCounter levelCounter;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("distanceTxt")]
|
||||
private TextWrapper _distanceTxt;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("retryCont")]
|
||||
private GameObject _retryCont;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("respawnCont")]
|
||||
private GameObject _respawnCont;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("respawnGauge")]
|
||||
private UIIncrementableGauge _respawnGauge;
|
||||
|
||||
[SerializeField]
|
||||
private SFX sfx;
|
||||
|
||||
private float _showTime;
|
||||
|
||||
private float _duration;
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
if (levelCounter != null)
|
||||
{
|
||||
levelCounter.Init(appController.GetPlayerLevel() + 1);
|
||||
}
|
||||
_respawnCont.gameObject.SetActive(value: false);
|
||||
_retryCont.gameObject.SetActive(value: false);
|
||||
sfx.Play(base.transform);
|
||||
ShowRespawn();
|
||||
}
|
||||
|
||||
private void ShowRespawn()
|
||||
{
|
||||
_showTime = Time.unscaledTime;
|
||||
|
||||
bool canRevive = false;
|
||||
_respawnCont.gameObject.SetActive(canRevive);
|
||||
_retryCont.gameObject.SetActive(!canRevive);
|
||||
_respawnGauge.QuickResetToLevel(0, 1f, force: true);
|
||||
}
|
||||
|
||||
public void Quit()
|
||||
{
|
||||
appController.Quit();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!_respawnCont.gameObject.activeSelf)
|
||||
{
|
||||
return;
|
||||
}
|
||||
float ratio = 1f - (Time.unscaledTime - _showTime) / _duration;
|
||||
if (ratio > 0f)
|
||||
{
|
||||
_respawnGauge.SetTargetValue(ratio, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_respawnCont.gameObject.SetActive(value: false);
|
||||
_retryCont.gameObject.SetActive(value: true);
|
||||
}
|
||||
}
|
||||
|
||||
public void NoThanks()
|
||||
{
|
||||
_respawnCont.gameObject.SetActive(value: false);
|
||||
_retryCont.gameObject.SetActive(value: true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user