示例#1
0
        protected void Start()
        {
            started = true;
            GameState.OnGameResume();
            uAdventureRaycaster = FindObjectOfType <uAdventureRaycaster>();
            if (!uAdventureRaycaster)
            {
                Debug.LogError("No uAdventureRaycaster was found in the scene!");
            }
            else
            {
                // When clicks are out, i capture them
                uAdventureRaycaster.Base = this.gameObject;
            }

            transitionManager = GetComponent <TransitionManager>();
            if (!transitionManager)
            {
                Debug.LogError("No TransitionManager was found in the scene!");
            }

            RunTarget(forceScene ? scene_name : GameState.CurrentTarget);
            gameExtensions.ForEach(g => g.OnAfterGameLoad());
            uAdventureInputModule.LookingForTarget = null;

            TimerController.Instance.Timers = GameState.GetTimers();
            TimerController.Instance.Run();
        }
        public void OnApplicationPause(bool paused)
        {
            if (Application.isEditor)
            {
                return;
            }

            if (!isSomethingRunning())
            {
                if (paused && GameState.Data.isSaveOnSuspend())
                {
                    GameState.OnGameSuspend();
                }

                if (!paused && GameState.Data.isRestoreAfterOpen())
                {
                    // TODO REPARE RESTORE AFTER OPEN
                    GameState.OnGameResume();
                    if (started)
                    {
                        RunTarget(GameState.CurrentTarget);
                        gameExtensions.ForEach(g => g.OnGameReady());
                        uAdventureInputModule.LookingForTarget = null;
                    }
                }
            }
        }
示例#3
0
        private IEnumerator StartGame(LoadingScreen loadScreen)
        {
            Debug.Log("[START GAME] GameState Restart...");
            GameState.Restart();
            started = true;
            Debug.Log("[START GAME] Game Resuming...");
            if (GameState.Data.isRestoreAfterOpen())
            {
                GameState.OnGameResume();
            }
            Debug.Log("[START GAME] After Game Load...");
            foreach (var g in PriorityAttribute.OrderExtensionsByMethod("OnAfterGameLoad", gameExtensions))
            {
                yield return(StartCoroutine(g.OnAfterGameLoad()));
            }
            uAdventureRaycaster = FindObjectOfType <uAdventureRaycaster>();
            if (!uAdventureRaycaster)
            {
                Debug.LogError("No uAdventureRaycaster was found in the scene!");
            }
            else
            {
                // When clicks are out, i capture them
                uAdventureRaycaster.Base = this.gameObject;
            }
            if (!TransitionManager)
            {
                Debug.LogError("No TransitionManager was found in the scene!");
            }

            Debug.Log("[START GAME] Running Target...");
            RunTarget(forceScene ? scene_name : GameState.CurrentTarget);
            yield return(new WaitUntil(() => !waitingRunTarget));

            Debug.Log("[START GAME] Game Ready...");
            foreach (var g in PriorityAttribute.OrderExtensionsByMethod("OnGameReady", gameExtensions))
            {
                yield return(StartCoroutine(g.OnGameReady()));
            }
            uAdventureInputModule.LookingForTarget = null;

            TimerController.Instance.Timers = GameState.GetTimers();
            TimerController.Instance.Run();
            Debug.Log("[START GAME] Done! (Waiting for target to be ready)");
            loadScreen.Close();
        }
示例#4
0
 public void OnApplicationPause(bool paused)
 {
     if (paused)
     {
         GameState.OnGameSuspend();
     }
     else
     {
         GameState.OnGameResume();
         if (started)
         {
             RunTarget(GameState.CurrentTarget);
             gameExtensions.ForEach(g => g.OnAfterGameLoad());
             uAdventureInputModule.LookingForTarget = null;
         }
     }
 }
示例#5
0
 public void OnApplicationPause(bool paused)
 {
     if (!isSomethingRunning())
     {
         if (paused)
         {
             GameState.OnGameSuspend();
         }
         else if (Application.isMobilePlatform)
         {
             GameState.OnGameResume();
             if (started)
             {
                 RunTarget(GameState.CurrentTarget);
                 gameExtensions.ForEach(g => g.OnGameReady());
                 uAdventureInputModule.LookingForTarget = null;
             }
         }
     }
 }