IEnumerator SceneView(ComponentPlacement placement = null) { currentPlacement = null; Debug.Log("View"); MapEidtoUI.Instance.ComponentPanel.Hide(); if (!placement) { var screenCenter = CameraManager.Instance.MainCamera.ViewportToWorldPoint(new Vector3(.5f, .5f, 0)).ToVector2(); placement = CurrentEditorState.PlacedComponents.MinOf(component => (component.transform.position.ToVector2() - screenCenter).magnitude); } UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(placement?.gameObject); while (true) { if (InputManager.CurrentInputScheme == InputSchemes.GamePad && InputManager.Input.EditorMode.ShowComponents.IsPressed()) { ChangeState(ComponentSelect()); } else if (InputManager.CurrentInputScheme == InputSchemes.Keyboard && InputManager.Input.EditorMode.ToggleComponents.UsePressed()) { ChangeState(ComponentSelect()); } yield return(null); } }
public static bool TryPickUpPlacement(ComponentPlacement placement) { if (Instance.currentPlacement) { return(false); } Instance.ChangeState(Instance.ComponentPlacement(placement)); return(true); }
public static void RemovePlacement(ComponentPlacement placement) { if (placement == Instance.currentPlacement) { Instance.currentPlacement = null; } Instance.CurrentEditorState.PlacedComponents.Remove(placement); placement.ComponentData.Component.Count++; Destroy(placement.gameObject); if (InputManager.CurrentInputScheme == InputSchemes.GamePad) { Instance.ChangeState(Instance.SceneView()); } else { Instance.ChangeState(Instance.ComponentSelect()); } }
IEnumerator ComponentPlacement(ComponentPlacement placement) { UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null); currentPlacement = placement; Debug.Log("Placement"); MapEidtoUI.Instance.ComponentPanel.Hide(); CameraManager.Instance.EditorCamera.GetComponent <Controller.EditorCameraController>().Follow = placement.transform; do { yield return(null); }while (!placement.Placed); if (InputManager.CurrentInputScheme == InputSchemes.GamePad) { ChangeState(SceneView(placement)); } else { ChangeState(ComponentSelect()); } }
IEnumerator ComponentSelect() { currentPlacement = null; Debug.Log("Component"); MapEidtoUI.Instance.ComponentPanel.Show(); var componentUI = MapEidtoUI.Instance.ComponentPanel.ComponentViews.FirstOrDefault(); UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(componentUI?.gameObject); while (true) { if (Input.InputManager.CurrentInputScheme == InputSchemes.GamePad && !Input.InputManager.Input.EditorMode.ShowComponents.IsPressed()) { ChangeState(SceneView()); } else if (InputManager.CurrentInputScheme == InputSchemes.Keyboard && InputManager.Input.EditorMode.ToggleComponents.UsePressed()) { ChangeState(SceneView()); } yield return(null); } }
public Factory() { ConceptualBuildPlacement = new ComponentPlacement(PlacementAction.Before, "XSL Transform Component"); ReferenceBuildPlacement = new ComponentPlacement(PlacementAction.Before, "XSL Transform Component"); }