private void Awake()
        {
            camera = Camera.main;

            m_Target = transform;

            m_PositionHandle = new PositionHandle(this);
            m_RotationHandle = new RotationHandle(this);
            m_ScaleHandle    = new ScaleHandle(this);
            m_CurrentHandle  = m_PositionHandle;
        }
Exemple #2
0
    public TransformManipulatorManager()
    {
        Service.Events.AddListener(EventId.EntitiesSelected, OnEntitiesSelected);
        rotationHandle = new RotationHandle();
        rotationHandle.Start();
        translationHandle = new TranslationHandle();
        translationHandle.Start();
        Service.FrameUpdate.RegisterForUpdate(this);
        GameObject multiHolderGameObject = new GameObject();

        multiHolder  = multiHolderGameObject.transform;
        currentGizmo = translationHandle;
    }
Exemple #3
0
    void Start()
    {
        if (this.GetComponent <PositionHandle>() == null)
        {
            gameObject.AddComponent <PositionHandle>();
        }
        if (this.GetComponent <RotationHandle>() == null)
        {
            gameObject.AddComponent <RotationHandle>();
        }

        posHandle         = GetComponent <PositionHandle>();
        rotHandle         = GetComponent <RotationHandle>();
        posHandle.enabled = false;
        rotHandle.enabled = false;
    }
Exemple #4
0
        private void Awake()
        {
            if (Camera == null)
            {
                Camera = Camera.main;
            }

            if (Run.Instance == null)
            {
                GameObject runGO = new GameObject();
                runGO.name = "Run";
                runGO.AddComponent <Run>();
            }
            RuntimeTools.Current = RuntimeTool.View;
            GameObject positionHandle = new GameObject();

            positionHandle.name = "PositionHandle";
            positionHandle.transform.SetParent(transform, false);
            m_positionHandle = positionHandle.AddComponent <PositionHandle>();
            positionHandle.SetActive(false);

            GameObject rotationHandle = new GameObject();

            rotationHandle.name = "RotationHandle";
            rotationHandle.transform.SetParent(transform, false);
            m_rotationHandle = rotationHandle.AddComponent <RotationHandle>();
            rotationHandle.SetActive(false);

            GameObject scaleHandle = new GameObject();

            scaleHandle.name = "ScaleHandle";
            scaleHandle.transform.SetParent(transform, false);
            m_scaleHandle = scaleHandle.AddComponent <ScaleHandle>();
            scaleHandle.SetActive(false);

            RuntimeSelection.SelectionChanged    += OnRuntimeSelectionChanged;
            RuntimeTools.ToolChanged             += OnRuntimeToolChanged;
            RuntimeTools.CameraEulerChanged      += OnCameraEulerChanged;
            UnityEditorToolsListener.ToolChanged += OnUnityEditorToolChanged;
            RuntimeTools.Current = RuntimeTool.Move;

            Camera.fieldOfView = 60;
            OnProjectionChanged();
        }
Exemple #5
0
        private LayoutInfo DefaultLayout(IWindowManager wm)
        {
            bool isDialog;

            WindowDescriptor sceneWd;
            GameObject       sceneContent;

            wm.CreateWindow(RuntimeWindowType.Scene.ToString(), out sceneWd, out sceneContent, out isDialog);

            WindowDescriptor sceneXWd;
            GameObject       sceneXContent;
            RuntimeWindow    xWindow = wm.CreateWindow(RuntimeWindowType.Scene.ToString(), out sceneXWd, out sceneXContent, out isDialog).GetComponent <RuntimeWindow>();

            // xWindow.CanActivate = false;

            RunNextFrame(() =>
            {
                IScenePivot xPivot    = xWindow.IOCContainer.Resolve <IScenePivot>();
                xPivot.Pivot.position = new Vector3(5, 0, 0);

                xWindow.Camera.transform.position = Vector3.right * 20;
                xWindow.Camera.transform.LookAt(xPivot.Pivot);
                xWindow.Camera.orthographic = true;

                PositionHandle positionHandle = wm.GetComponents(xWindow.transform).SelectMany(c => c.GetComponentsInChildren <PositionHandle>(true)).FirstOrDefault();
                positionHandle.GridSize       = 2;

                RotationHandle rotationHandle = wm.GetComponents(xWindow.transform).SelectMany(c => c.GetComponentsInChildren <RotationHandle>(true)).FirstOrDefault();
                rotationHandle.GridSize       = 5;

                Tab tab = Region.FindTab(xWindow.transform);
                tab.IsCloseButtonVisible = false;
            });

            WindowDescriptor gameWd;
            GameObject       gameContent;

            wm.CreateWindow(RuntimeWindowType.Game.ToString(), out gameWd, out gameContent, out isDialog);

            WindowDescriptor inspectorWd;
            GameObject       inspectorContent;

            wm.CreateWindow(RuntimeWindowType.Inspector.ToString(), out inspectorWd, out inspectorContent, out isDialog);

            WindowDescriptor hierarchyWd;
            GameObject       hierarchyContent;

            wm.CreateWindow(RuntimeWindowType.Hierarchy.ToString(), out hierarchyWd, out hierarchyContent, out isDialog);

            LayoutInfo layout = new LayoutInfo(false,
                                               new LayoutInfo(true,
                                                              new LayoutInfo(
                                                                  new LayoutInfo(sceneContent.transform, sceneWd.Header, sceneWd.Icon),
                                                                  new LayoutInfo(gameContent.transform, gameWd.Header, gameWd.Icon)),
                                                              new LayoutInfo(sceneXContent.transform, sceneXWd.Header, sceneXWd.Icon),
                                                              0.5f),
                                               new LayoutInfo(true,
                                                              new LayoutInfo(inspectorContent.transform, inspectorWd.Header, inspectorWd.Icon),
                                                              new LayoutInfo(hierarchyContent.transform, hierarchyWd.Header, hierarchyWd.Icon),
                                                              0.5f),
                                               0.75f);

            return(layout);
        }