void OnEnter(PlayingEnvironment environment) { _data.ParachuteEditor.Initialize(_editorState, _editorParachuteChanges); _environment = environment; var editLocation = _environment.Spawnpoint.AsParachuteLocation(); var pilot = environment.Pilot; pilot.TrajectoryVisualizer.Deactivate(); _data.ParachuteEditor.transform.Set(editLocation); _data.ParachuteEditor.gameObject.SetActive(true); _isConfigUpdated = false; _currentConfig = _activeParachuteConfig.Get(); CreateEditorChute(_activeParachuteConfig.Get(), editLocation); _disposeParachuteBuilder = _activeParachuteConfig.OnUpdate .Subscribe(config => { _currentConfig = config; _isConfigUpdated = true; }); _data.CameraManager.SwitchMount(_data.EditorCamera); _data.EditorCamera.Center(); OnResume(Maybe <RespawnRequest> .Nothing, transitToParachuteEditor: false); }
public PlayingEnvironment(SpawnpointLocation spawnpoint, Wingsuit pilot, ParachuteConfig parachuteConfig, PilotCameraMountId selectedMount = PilotCameraMountId.Orbit) { Spawnpoint = spawnpoint; Pilot = pilot; ParachuteConfig = parachuteConfig; SelectedCameraMount = selectedMount; }
void CreateEditorChute(ParachuteConfig config, ImmutableTransform transform) { if (_editorParachute != null) { _editorParachute.DetachPilot(); GameObject.Destroy(_editorParachute.Root.gameObject); } _editorParachute = _data.EditorSpawner.Create(config, transform, "EditorParachute"); _environment.Pilot.SetKinematic(); _environment.Pilot.OnDespawn(); _environment.Pilot.transform.position = transform.Position; _environment.Pilot.transform.rotation = transform.Rotation; _environment.Pilot.OnSpawn(); _environment.Pilot.SetKinematic(); _editorParachute.AttachToPilot(_environment.Pilot, Parachute.DefaultUnfoldOrientation, _data.GameSettingsProvider); UnityParachuteFactory.SetKinematic(_editorParachute); _data.EditorCamera.SetTarget(_editorParachute); _editorParachuteChanges.OnNext(_editorParachute); }
public PlayingEnvironment UpdateParachuteConfig(ParachuteConfig parachuteConfig) { return(new PlayingEnvironment(Spawnpoint, Pilot, parachuteConfig, SelectedCameraMount)); }