Esempio n. 1
0
    public void OnPointerClick(PointerEventData eventData)
    {
        mouseClickPosition = eventData.position;
        Messager.SendMassege("Клик по объекту: " + eventData);
        if (!Input.GetKey(KeyCode.RightControl) && !Input.GetKey(KeyCode.LeftControl))
        {
            //DeselectAll(eventData);
        }

        //OnSelect(eventData);
        //mouseClickPosition = eventData.position;
        Vector2 objOnScreen = new Vector2();

        //Utility.WorldToScreenPoint(selectObject.transform.position, out objOnScreen);

        Debug.Log("Позиция объекта: " + objOnScreen);
        foreach (SelectableObject sObj in SelectableObject.AllSelectableObjects)
        {
            if (mouseClickPosition == objOnScreen)
            {
                sObj.SelectObject();
                Debug.Log("Всего выделенных объектов: " + SelectableObject.AllSelectedObjectCount());
            }
        }



        OnSelect(eventData);
    }
Esempio n. 2
0
 private void GetInfo()
 {
     if (Input.GetMouseButtonUp(0))
     {
         Messager.SendMassege(Camera.main.WorldToViewportPoint(objBounds.center).ToString());
         Messager.SendMassege(Camera.main.WorldToViewportPoint(objBounds.center + objBounds.extents).ToString());
         Messager.SendMassege(Camera.main.WorldToViewportPoint(objBounds.center - objBounds.extents).ToString());
         //Messager.SendMassege(Camera.main.WorldToViewportPoint(objBounds.center + objBounds.extents).ToString());
         //Messager.SendMassege(Camera.main.WorldToScreenPoint(objBounds.center + objBounds.extents).ToString());
     }
 }