Exemple #1
0
        private void Element_MouseMove(object sender, MouseEventArgs args)
        {
            var buttons  = GetMouseButtons(args);
            var id       = buttons & FirstMouseButton;
            var position = GetPosition(args);

            PointerMove?.Invoke(this, new PointerEventArgs(CurrentTime, position, PointerId.FromMouse(id), buttons));
        }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        if (objectSelected)
        {
            if (playerControl.getIsMoving())
            {
                CursorMovement cursorMovement = PointerMove.GetComponent <CursorMovement>();
                if (!cursorMovement.getIsOverPlayer())
                {
                    if (Input.GetKeyDown(KeyCode.Space))
                    {
                        destination = Pointer.transform.position - new Vector3(0, 2.95001f, 0);
                        float m = Mathf.Abs(destination.x - transform.position.x), n = Mathf.Abs(destination.z - transform.position.z);
                        switch ((int)(m + n) <= 3)
                        {
                        case true:
                            transform.position = destination;
                            objectSelected     = false;
                            SelectPlayer sp = Pointer.GetComponent <SelectPlayer>();
                            sp.setIsSelected(false);
                            playerControl.setIsMoving(false);
                            break;

                        case false:
                            showUnitWarning();
                            break;
                        }
                    }
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            UnitWarning();
        }
    }
Exemple #3
0
 protected virtual void OnPointerMove(object sender, PointerMoveEventArgs e)
 {
     PointerMove?.Invoke(sender, e);
 }
 public void OnDrag(PointerEventData eventData)
 {
     PointerMove?.Invoke(eventData.position);
 }