Esempio n. 1
0
        public void OnGameStateChanged(ClientGameState state)
        {
            if (State.Value == ClientGameState.Playing ||
                State.Value == ClientGameState.PlayingTutorial)
            {
                Labyrinth.Value.GenerateLabyrinthVisual();
                Labyrinth.Value.Init(enableCamera: false);
                roundBeginTime = DateTime.Now;

                if (controls != null)
                {
                    controls.StopAllMovement();
                    controls.ResetPositionAndRotation();
                }

                if (waitingForNextRoundRoom != null)
                {
                    waitingForNextRoundRoom.SetActive(false);
                }

                if (controls != null)
                {
                    controls.IsPlayerControlsEnabled.Value = true;
                }
            }
            else if (
                State.Value == ClientGameState.ViewingLocalReplay ||
                State.Value == ClientGameState.WaitingForNextLevel ||
                State.Value == ClientGameState.ViewingGlobalReplay)
            {
                if (Labyrinth.Value != null)
                {
                    Labyrinth.Value.gameObject.Destroy();
                    Labyrinth.Value = null;
                    //Labyrinth.Value.Init(enableCamera: false);
                }

                controls.IsPlayerControlsEnabled.Value = false;
                controls.StopAllMovement();
                controls.ResetPositionAndRotation();

                if (waitingForNextRoundRoom != null)
                {
                    waitingForNextRoundRoom.SetActive(true);
                }
            }
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            GUI.enabled = Application.isPlaying;

            HeadsetControlsAsset scriptableControler = target as HeadsetControlsAsset;

            if (GUILayout.Button("On Controls Enable Value Changed"))
            {
                // ??
                scriptableControler.IsPlayerControlsEnabled.OnValueChangedHandler.Invoke(scriptableControler.IsPlayerControlsEnabled.Value);
            }

            if (GUILayout.Button("Stop All Movement"))
            {
                scriptableControler.StopAllMovement();
            }
        }