Пример #1
0
        // Update is called once per frame
        void Update()
        {
            if (lockControls == false)
            {
                //press A to select all parts
                if (Input.GetKeyUp(KeyCode.A))
                {
                    if (selectedParts.Count == parts.Count)
                    {
                        foreach (KitbashPart part in parts)
                        {
                            gizmo.RemoveTarget(part.transform);
                        }
                    }
                    else
                    {
                        foreach (KitbashPart part in parts)
                        {
                            gizmo.AddTarget(part.transform);
                        }
                    }
                }

                if ((Input.GetKeyUp(KeyCode.LeftControl) || Input.GetKeyUp(KeyCode.RightControl)) && Input.GetKeyUp(KeyCode.C))
                {
                    CopySelected();
                }

                if (copiedParts.Count > 0 && ((Input.GetKeyUp(KeyCode.LeftControl) || Input.GetKeyUp(KeyCode.RightControl)) && Input.GetKeyUp(KeyCode.V)))
                {
                    PasteSelected();
                }

                //Delete selection.
                if (Input.GetKeyUp(KeyCode.Delete))
                {
                    DestroySelected();
                }
            }


            if (fillModeActive == true && Input.GetKeyUp(KeyCode.Mouse0) == true)
            {
                /* if (hit.collider != null && unwrapTex != null)
                 * {
                 *   Vector2 pixelUV = hit.textureCoord * workingResolution;
                 *
                 *   int x = (int)pixelUV.x;
                 *   int y = (int)pixelUV.y;
                 *
                 *   ScanlineFloodFill(unwrapTex, new Vector2Int(x, y), unwrapTex.GetPixel(x, y), fillColor);
                 *   rend.material.SetTexture("_BaseMap", unwrapTex);
                 * }
                 *
                 */
            }
        }
Пример #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();
        }
    }
Пример #3
0
    public async void StartManipulation()
    {
        if (Locked)
        {
            Notifications.Instance.ShowNotification("Locked", "This action point is locked and can't be manipulated");
        }
        else
        {
            try {
                await WebsocketManager.Instance.UpdateActionPointPosition(Data.Id, new Position(), true);

                // We have clicked with left mouse and started manipulation with object
                Debug.LogWarning("Turning on gizmo overlay");
                manipulationStarted = true;
                updatePosition      = false;
                tfGizmo.AddTarget(Sphere.transform);
                outlineOnClick.GizmoHighlight();
            } catch (RequestFailedException ex) {
                Notifications.Instance.ShowNotification("Action point pose could not be changed", ex.Message);
            }
        }
    }