quantum-space-buddies/QSB/QSBBehaviour.cs
Ricardo Lopes a1177515b3
Preserve time scale (#18)
* Create QSBBehaviour

* Preserve timescale

* Cleanup
2020-02-18 21:32:26 +01:00

38 lines
886 B
C#

using UnityEngine;
using UnityEngine.SceneManagement;
namespace QSB
{
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() { }
}
}