// Handles Detaching Hardpoint-Mountpoint pairs void Handle(DetachEvent e) { Hardpoint hardpoint; if (e.Child.parent.TryGetComponents(out hardpoint)) { e.Child.transform.SetParent(null); Ego.SetParent(null, e.Child); Rigidbody2D rigidbody2D; // Should actually return a rigidbody to their defaults for their dropped state, which is usually this if (e.Child.TryGetComponents(out rigidbody2D)) { rigidbody2D.isKinematic = false; rigidbody2D.simulated = true; } hardpoint.Attached = null; } }
void DetachPlayer(DetachEvent evt) { bool isPlaying = ViewModel.VideoPlayer.Playing; /* Pause the player here to prevent the sink drawing while the windows * are beeing changed */ ViewModel.VideoPlayer.PauseCommand.Execute(false); videoPlayerDetachHelper.Detach(playercapturer, Constants.SOFTWARE_NAME, videowidgetsbox, () => { videowidgetsbox.Visible = detachedPlayer; detachedPlayer = !detachedPlayer; playsSelection.ExpandTabs = detachedPlayer; if (isPlaying) { ViewModel.VideoPlayer.PlayCommand.Execute(); } playercapturer.Detach(detachedPlayer); return(true); }); }