quantum-space-buddies/QSB/QSBBehaviour.cs
AmazingAlek d7c0c06698
Alek/decoupling (#23)
* refactoring
2020-02-21 23:36:07 +01:00

38 lines
893 B
C#

using UnityEngine;
using UnityEngine.SceneManagement;
namespace QSB
{
public abstract class QSBBehaviour : MonoBehaviour
{
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()
{
IsPlayerAwake = true;
}
protected virtual void StartSolarSystem() { }
protected virtual void StartEyeOfUniverse() { }
}
}