public override void OnClick(Click type)
 {
     if (!enabled)
     {
         return;
     }
     if (GameManager.Instance.GetEditorState() == GameManager.EditorStateEnum.SelectingActionPoint ||
         GameManager.Instance.GetEditorState() == GameManager.EditorStateEnum.SelectingActionPointParent)
     {
         GameManager.Instance.ObjectSelected(this);
         return;
     }
     if (GameManager.Instance.GetEditorState() != GameManager.EditorStateEnum.Normal)
     {
         return;
     }
     if (GameManager.Instance.GetGameState() != GameManager.GameStateEnum.ProjectEditor)
     {
         Notifications.Instance.ShowNotification("Not allowed", "Editation of action point only allowed in project editor");
         return;
     }
     // HANDLE MOUSE
     if (type == Click.MOUSE_LEFT_BUTTON || type == Click.LONG_TOUCH)
     {
         StartManipulation();
     }
     else if (type == Click.MOUSE_RIGHT_BUTTON || type == Click.TOUCH)
     {
         ShowMenu(false);
         tfGizmo.ClearTargets();
         outlineOnClick.GizmoUnHighlight();
     }
 }
Example #2
0
    public async override void OnClick(Click type)
    {
        if (GameManager.Instance.GetEditorState() == GameManager.EditorStateEnum.SelectingActionObject ||
            GameManager.Instance.GetEditorState() == GameManager.EditorStateEnum.SelectingActionPointParent)
        {
            GameManager.Instance.ObjectSelected(this);
            return;
        }
        if (GameManager.Instance.GetEditorState() != GameManager.EditorStateEnum.Normal)
        {
            return;
        }
        if (GameManager.Instance.GetGameState() != GameManager.GameStateEnum.SceneEditor &&
            GameManager.Instance.GetGameState() != GameManager.GameStateEnum.ProjectEditor)
        {
            Notifications.Instance.ShowNotification("Not allowed", "Editation of action object only allowed in scene or project editor");
            return;
        }

        // HANDLE MOUSE
        if (type == Click.MOUSE_LEFT_BUTTON || type == Click.LONG_TOUCH)
        {
            // We have clicked with left mouse and started manipulation with object
            if (GameManager.Instance.GetGameState() == GameManager.GameStateEnum.SceneEditor)
            {
                try {
                    await WebsocketManager.Instance.UpdateActionObjectPose(Data.Id, new IO.Swagger.Model.Pose(new Orientation(), new Position()), true);

                    manipulationStarted = true;
                    tfGizmo.AddTarget(Model.transform);
                    outlineOnClick.GizmoHighlight();
                } catch (RequestFailedException ex) {
                    Notifications.Instance.ShowNotification("Object pose could not be changed", ex.Message);
                }
            }
        }
        else if (type == Click.MOUSE_RIGHT_BUTTON || type == Click.TOUCH)
        {
            ShowMenu();
            tfGizmo.ClearTargets();
            outlineOnClick.GizmoUnHighlight();
        }
    }
Example #3
0
        public override void OnClick(Click type)
        {
            if (GameManager.Instance.GetEditorState() == GameManager.EditorStateEnum.SelectingActionObject ||
                GameManager.Instance.GetEditorState() == GameManager.EditorStateEnum.SelectingActionPointParent)
            {
                GameManager.Instance.ObjectSelected(this);
                return;
            }
            if (GameManager.Instance.GetEditorState() != GameManager.EditorStateEnum.Normal)
            {
                return;
            }
            if (GameManager.Instance.GetGameState() != GameManager.GameStateEnum.SceneEditor &&
                GameManager.Instance.GetGameState() != GameManager.GameStateEnum.ProjectEditor)
            {
                Notifications.Instance.ShowNotification("Not allowed", "Editation of action object only allowed in scene or project editor");
                return;
            }

            // HANDLE MOUSE
            if (type == Click.MOUSE_LEFT_BUTTON || type == Click.LONG_TOUCH)
            {
                // We have clicked with left mouse and started manipulation with object
                if (GameManager.Instance.GetGameState() == GameManager.GameStateEnum.SceneEditor)
                {
                    manipulationStarted = true;
                    HideRobotEE();
                    TransformGizmo.Instance.AddTarget(transform);
                    outlineOnClick.GizmoHighlight();
                }
            }
            else if (type == Click.MOUSE_RIGHT_BUTTON || type == Click.TOUCH)
            {
                ShowMenu();
                TransformGizmo.Instance.ClearTargets();
                outlineOnClick.GizmoUnHighlight();
            }
        }
 /// <summary>
 /// Called via SendMessage("ClearGizmo") from TransformGizmo.cs
 /// </summary>
 public void ClearGizmo()
 {
     OutlineOnClick.GizmoUnHighlight();
 }