Exemple #1
0
    private void Update()
    {
        var actionMap = _menuActionMapProvider.ActionMap.V;

        if (actionMap.PollButtonEvent(MenuAction.Confirm) == ButtonEvent.Down)
        {
            _eventSystem.Emit(new Events.OnConfirmPressed());
        }
        if (actionMap.PollButtonEvent(MenuAction.Back) == ButtonEvent.Down)
        {
            _eventSystem.Emit(new Events.OnBackPressed());
        }
        if (actionMap.PollButtonEvent(MenuAction.Pause) == ButtonEvent.Down)
        {
            _eventSystem.Emit(new Events.OnPausePressed());
        }
    }
Exemple #2
0
        void Update()
        {
            var isOculusHomeOpened = !OVRPlugin.hasVrFocus && OVRPlugin.userPresent;

            if (_isOculusHomeCurrentlyOpened != isOculusHomeOpened)
            {
                _isOculusHomeCurrentlyOpened = isOculusHomeOpened;
                if (!isOculusHomeOpened)
                {
                    Debug.Log("VR focus acquired!");
                    _eventSystem.Emit(new Events.UnfreezeGame());
                }
                else
                {
                    Debug.Log("VR focus lost!");
                    _eventSystem.Emit(new Events.FreezeGame());
                }
            }
        }
Exemple #3
0
    public IEnumerator <WaitCommand> Respawn(SpawnpointLocation spawnpoint)
    {
        if (!_isRespawning)
        {
            _isRespawning = true;

            if (_currentPlayer != null && _currentPlayer.GameObject.activeInHierarchy)
            {
                _currentPlayer = null;
                _wingsuit      = null;
            }

            var networkSystems = _activeNetwork.NetworkSystems;

            if (_onReplicatedObjectAdded == null)
            {
                _onReplicatedObjectAdded = new Event(networkSystems.ObjectStore, "ObjectAdded");
            }
            // Wait until a player has been created by the replicated object store
            var asyncPlayer = AsyncResult <ReplicatedObject> .SingleResultFromEvent(
                _onReplicatedObjectAdded,
                IsOwnedPilot);

            var respawnRequest = networkSystems.MessagePool.GetMessage <GameMessages.RespawnPlayerRequest>();
            respawnRequest.Content.Spawnpoint = spawnpoint.AsWingsuitLocation();
            respawnRequest.Content.InputPitch = _playerActionMap.V.PollAxis(WingsuitAction.Pitch) +
                                                _playerActionMap.V.PollMouseAxis(WingsuitAction.Pitch);
            respawnRequest.Content.InputRoll = _playerActionMap.V.PollAxis(WingsuitAction.Roll) +
                                               _playerActionMap.V.PollMouseAxis(WingsuitAction.Roll);
            _activeNetwork.SendToAuthority(respawnRequest);

            yield return(asyncPlayer.WaitUntilReady);

            _currentPlayer = asyncPlayer.Result;

            var playerDeps = new DependencyContainer();
            playerDeps.AddDependency("gameClock", _gameClock);
            DependencyInjector.Default.Inject(_currentPlayer.GameObject, playerDeps, overrideExisting: true);

            _wingsuit = _currentPlayer.GameObject.GetComponent <Wingsuit>();
            _wingsuit.AlphaManager.SetAlpha(1f);

//            if (_activeNetwork.AuthorityConnectionId != ConnectionId.Self)
//            {
//                SwitchToActiveMount();
//            }
//            else
//            {
//                Debug.Log("Ain't gonna switch no mount for yourself yo, you be dedicated!");
//            }


            if (_gameSettingsProvider != null)
            {
                ApplySettings(_gameSettingsProvider.ActiveSettings);
            }

            var pilot = _currentPlayer.GameObject.GetComponent <Wingsuit>();
            _eventSystem.Emit(new Events.PlayerSpawned(pilot));

            _isRespawning = false;
        }
    }