Exemple #1
0
 public PlayingEnvironment(SpawnpointLocation spawnpoint, Wingsuit pilot, ParachuteConfig parachuteConfig,
                           PilotCameraMountId selectedMount = PilotCameraMountId.Orbit)
 {
     Spawnpoint          = spawnpoint;
     Pilot               = pilot;
     ParachuteConfig     = parachuteConfig;
     SelectedCameraMount = selectedMount;
 }
Exemple #2
0
        IEnumerator <WaitCommand> OnEnter(SpawnpointLocation spawnpoint)
        {
            _data.ChallengeAnnouncerUi.enabled        = true;
            _data.JoystickActivator.enabled           = false;
            _data.ThirdPersonCameraController.enabled = true;

            // TODO Don't spawn the player this is now the responsisiblity of the wingsuit state
            //yield return _data.PlayerPilotSpawner.Respawn(spawnpoint).AsWaitCommand();

            var environment = new PlayingEnvironment(
                spawnpoint: spawnpoint,
                pilot: null,
                parachuteConfig: _activeParachuteConfig.Get());

            _playingStateMachine.Transition(PlayingStates.FlyingWingsuit, environment, Maybe.Just(new RespawnRequest()));
            yield return(WaitCommand.WaitRoutine(CameraTransitions.FadeIn(_data.CameraManager.Rig.ScreenFader, _data.MenuClock, _data.FaderSettings)));
        }
Exemple #3
0
 public SpawnpointSelected(SpawnpointLocation spawnpoint)
 {
     Spawnpoint = spawnpoint;
 }
Exemple #4
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;
        }
    }