public void advanceIfPossible() { if (canAdvance() && FadeController.Instance.IsFinish) // TODO Ensure better concurrency safety for FadeController { print("Currently running epoch " + EpochUtil.epochName(currentEpoch) + ", advancing"); playerCharacter.SetActive(false); FadeController.Instance.FadeOut(1.0f, Color.black, () => { currentEpoch = EpochUtil.next(currentEpoch); broadcastEpochChange(); print("Currently running epoch " + EpochUtil.epochName(currentEpoch)); FadeController.Instance.FadeIn(1.0f, Color.black); }); } }
private void Start() { playerCharacter = GameObject.FindGameObjectWithTag("Player"); if (playerCharacter == null) { Debug.LogError("No player object found in scene"); } listenerScripts = Resources.FindObjectsOfTypeAll <EpochChangeListenerScript>() .Where(obj => !Util.IsPrefab(obj.gameObject)) .ToArray(); broadcastEpochChange(); print("Currently running epoch " + EpochUtil.epochName(currentEpoch)); advanceIfPossible(); }