quantum-space-buddies/QSB/QSBBehaviour.cs

38 lines
893 B
C#
Raw Normal View History

using UnityEngine;
using UnityEngine.SceneManagement;
namespace QSB
{
2020-02-21 23:36:07 +01:00
public abstract class QSBBehaviour : MonoBehaviour
{
2020-02-21 23:36:07 +01:00
protected bool IsPlayerAwake;
protected virtual void Awake()
{
GlobalMessenger.AddListener("WakeUp", PlayerWokeUp);
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (scene.name == "SolarSystem")
{
StartSolarSystem();
}
else if (scene.name == "EyeOfTheUniverse")
{
StartEyeOfUniverse();
}
}
protected virtual void PlayerWokeUp()
{
2020-02-21 23:36:07 +01:00
IsPlayerAwake = true;
}
protected virtual void StartSolarSystem() { }
protected virtual void StartEyeOfUniverse() { }
}
}