53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Invector;
|
|
using Invector.vItemManager;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Beyond
|
|
{
|
|
[vClassHeader("Item Collected Display", helpBoxText = "Use this to display the name of collected items", openClose = false)]
|
|
public class bItemCollectionDisplay : vMonoBehaviour
|
|
{
|
|
private static bItemCollectionDisplay instance;
|
|
|
|
/// <summary>
|
|
/// Instance of the <seealso cref="vItemCollectionDisplay"/>
|
|
/// </summary>
|
|
///
|
|
public static bItemCollectionDisplay Instance
|
|
{
|
|
get
|
|
{
|
|
if (instance == null) { instance = GameObject.FindObjectOfType<bItemCollectionDisplay>(true); }
|
|
return bItemCollectionDisplay.instance;
|
|
}
|
|
}
|
|
|
|
public bItemCollectionTextHUD itemCollectedDisplayPrefab;
|
|
|
|
private Action onEnable;
|
|
|
|
private void OnEnable()
|
|
{
|
|
onEnable?.Invoke();
|
|
onEnable = null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Send text to display in the HUD with fade in <seealso cref="vItemCollectionTextHUD"/>
|
|
/// </summary>
|
|
/// <param name="message">message to show</param>
|
|
/// <param name="timeToStay">time to stay showing</param>
|
|
/// <param name="timeToFadeOut">time to fade out</param>
|
|
public void FadeText(string message, float timeToStay, float timeToFadeOut)
|
|
{
|
|
var display = Instantiate(itemCollectedDisplayPrefab);
|
|
display.transform.SetParent(transform, false);
|
|
display.transform.SetAsFirstSibling();
|
|
display.Show(message, timeToStay, timeToFadeOut);
|
|
}
|
|
}
|
|
} |