示例#1
0
        // Initialization method.  Called after the state
        // is added to the stack.
        public override void Initialize()
        {
            CommonData.mainGame.SelectAndPlayMusic(CommonData.prefabs.gameMusic, true);
            fixedUpdateTimestamp = 0;
            if (CommonData.vrPointer != null)
            {
                CommonData.vrPointer.SetActive(false);
            }
            Time.timeScale = 1.0f;
            double gravity_y =
                Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue(
                    StringConstants.RemoteConfigPhysicsGravity).DoubleValue;

            Physics.gravity = new Vector3(0, (float)gravity_y, 0);
            CommonData.gameWorld.ResetMap();
            Utilities.HideDuringGameplay.OnGameplayStateChange(true);
            CommonData.mainCamera.mode = CameraController.CameraMode.Gameplay;

            gameplayRecordingEnabled = Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue(
                StringConstants.RemoteConfigGameplayRecordingEnabled).BooleanValue;

            if (gameplayRecordingEnabled)
            {
                gameplayRecorder = new GameplayRecorder(CommonData.gameWorld.worldMap.name, 1);

                // Subscribe player spawn event in order to reset replay data whenever it is triggered.
                CommonData.mainGame.PlayerSpawnedEvent.AddListener(OnPlayerSpawned);
            }
            Screen.sleepTimeout = SleepTimeout.NeverSleep;

            dialogComponent = SpawnUI <Menus.FloatingButtonGUI>(StringConstants.PrefabFloatingButton);
            PositionButton();

            CommonData.gameWorld.MergeMeshes();

            // Retrieve metadata from the storage bucket.  This is also a light-weighted way to check
            // if the file exists.  If not, it returns 404 Not Found and the task would be in Faulted
            // state.
            TimeDataUtil.GetBestSharedReplayPathAsync(CommonData.gameWorld.worldMap)
            .ContinueWith(task => {
                bestReplayPath = task.Result;
            });
        }
示例#2
0
        // Initialization method.  Called after the state
        // is added to the stack.
        public override void Initialize()
        {
            CommonData.mainGame.SelectAndPlayMusic(CommonData.prefabs.gameMusic, true);
            fixedUpdateTimestamp = 0;
            Time.timeScale       = 1.0f;
            var    remoteConfig = FirebaseRemoteConfig.DefaultInstance;
            double gravity_y    = remoteConfig.GetValue(StringConstants.RemoteConfigPhysicsGravity).DoubleValue;

            Physics.gravity = new Vector3(0, (float)gravity_y, 0);
            CommonData.gameWorld.ResetMap();
            Utilities.HideDuringGameplay.OnGameplayStateChange(true);
            CommonData.mainCamera.mode = CameraController.CameraMode.Gameplay;

            gameplayRecordingEnabled = remoteConfig.GetValue(StringConstants.RemoteConfigGameplayRecordingEnabled).BooleanValue;

            if (gameplayRecordingEnabled)
            {
                gameplayRecorder = new GameplayRecorder(CommonData.gameWorld.worldMap.name, 1);

                // Subscribe player spawn event in order to reset replay data whenever it is triggered.
                CommonData.mainGame.PlayerSpawnedEvent.AddListener(OnPlayerSpawned);
            }
            Screen.sleepTimeout = SleepTimeout.NeverSleep;

            dialogComponent = SpawnUI <Menus.FloatingButtonGUI>(StringConstants.PrefabFloatingButton);
            PositionButton();

            CommonData.gameWorld.MergeMeshes();

            // Retrieve path to the best replay record
            if (gameplayRecordingEnabled)
            {
                TimeDataUtil.GetBestSharedReplayPathAsync(CommonData.gameWorld.worldMap)
                .ContinueWith(task => {
                    bestReplayPath = task.Result;
                });
            }
        }