mirror of
https://github.com/LazyDuchess/OpenTS2.git
synced 2025-01-22 08:11:47 -05:00
Singleton -> Instance
This commit is contained in:
parent
c3fca9727f
commit
9ee540836f
5 changed files with 16 additions and 16 deletions
|
@ -12,27 +12,27 @@ namespace OpenTS2.Audio
|
|||
[RequireComponent(typeof(AudioSource))]
|
||||
public class MusicController : MonoBehaviour
|
||||
{
|
||||
public static MusicController Singleton { get; private set; }
|
||||
public static MusicController Instance { get; private set; }
|
||||
private AudioSource _audioSource;
|
||||
private AudioAsset _currentAudioAsset;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Singleton = this;
|
||||
Instance = this;
|
||||
_audioSource = GetComponent<AudioSource>();
|
||||
}
|
||||
|
||||
public static void PlayMusic(AudioAsset music)
|
||||
{
|
||||
Singleton._currentAudioAsset = music;
|
||||
Singleton._audioSource.clip = music.Clip;
|
||||
Singleton._audioSource.volume = 1f;
|
||||
Singleton._audioSource.Play();
|
||||
Instance._currentAudioAsset = music;
|
||||
Instance._audioSource.clip = music.Clip;
|
||||
Instance._audioSource.volume = 1f;
|
||||
Instance._audioSource.Play();
|
||||
}
|
||||
|
||||
public static void FadeOutMusic()
|
||||
{
|
||||
Singleton.StartCoroutine(Singleton.FadeOut());
|
||||
Instance.StartCoroutine(Instance.FadeOut());
|
||||
}
|
||||
|
||||
IEnumerator FadeOut()
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace OpenTS2.Diagnostic
|
|||
/// </summary>
|
||||
public class CheatConsoleController : MonoBehaviour, IConsoleOutput
|
||||
{
|
||||
public static CheatConsoleController Singleton { get; private set; }
|
||||
public static CheatConsoleController Instance { get; private set; }
|
||||
public GameObject ConsoleParent;
|
||||
public InputField CheatInputField;
|
||||
public Text ConsoleOutput;
|
||||
|
@ -24,7 +24,7 @@ namespace OpenTS2.Diagnostic
|
|||
|
||||
private void Awake()
|
||||
{
|
||||
Singleton = this;
|
||||
Instance = this;
|
||||
CheatInputField.onValueChanged.AddListener(OnTextChanged);
|
||||
ConsoleParent.SetActive(false);
|
||||
DontDestroyOnLoad(this);
|
||||
|
|
|
@ -12,13 +12,13 @@ namespace OpenTS2.Engine
|
|||
/// </summary>
|
||||
public class AssetController : MonoBehaviour
|
||||
{
|
||||
public static AssetController Singleton { get; private set; }
|
||||
public static Font DefaultFont => Singleton._defaultFont;
|
||||
public static AssetController Instance { get; private set; }
|
||||
public static Font DefaultFont => Instance._defaultFont;
|
||||
[SerializeField]
|
||||
private Font _defaultFont;
|
||||
private void Awake()
|
||||
{
|
||||
Singleton = this;
|
||||
Instance = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,13 +13,13 @@ namespace OpenTS2.Engine
|
|||
/// </summary>
|
||||
public class MemoryController : MonoBehaviour
|
||||
{
|
||||
public static MemoryController Singleton { get; private set; }
|
||||
public static MemoryController Instance { get; private set; }
|
||||
|
||||
private static Action MarkedForRemoval;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Singleton = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public static void MarkForRemoval(Action action)
|
||||
|
|
|
@ -9,7 +9,7 @@ using UnityEngine;
|
|||
namespace OpenTS2.UI {
|
||||
public class CursorController : MonoBehaviour
|
||||
{
|
||||
public static CursorController Singleton { get; private set; }
|
||||
public static CursorController Instance { get; private set; }
|
||||
|
||||
public enum CursorType
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ namespace OpenTS2.UI {
|
|||
|
||||
private void Awake()
|
||||
{
|
||||
Singleton = this;
|
||||
Instance = this;
|
||||
RegisterCursors();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue