Exemple #1
0
 private void Awake()
 {
     Assert.IsNotNull(endGameTitle, "Missing endGameTitle");
     Assert.IsNotNull(endGameMessage, "Missing endGameMessage");
     Assert.IsNotNull(endGameButton, "Missing endGameButton");
     EndGameControlsSetActive(false);
     fadeOutScreen = Resources.FindObjectsOfTypeAll <FadeOutScreen>()[0];
     Assert.IsNotNull(fadeOutScreen, "Missing dayEndAnimation");
 }
Exemple #2
0
    void OnEnable()
    {
        //Check if instance already exists
        if (Instance == null)
        {
            //if not, set instance to this
            Instance = this;
        }

        //If instance already exists and it's not this:
        else if (Instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of an AudioManager.
            Debug.LogError("There can only be one AudioManager instantiated. Destroying this Instance...");
            Destroy(this);
        }
    }
 void Awake()
 {
     instance = this;
 }