Beispiel #1
0
        Vector2 WorldPositionToUI(Vector3 worldPosition, bool scaleToRadar = false)
        {
            Vector2 result = Vector2.zero;

            result.x = worldPosition.x;
            result.y = worldPosition.z;

            if (scaleToRadar)
            {
                result *= minimap.GetScaleFactor();
            }

            return(result);
        }
        public void OnPointerDown(PointerEventData eventData)
        {
            if (eventData.button == PointerEventData.InputButton.Left)
            {
                minimapCameraIcon.OnMapClick(eventData);
            }
            else if (eventData.button == PointerEventData.InputButton.Right)
            {
                var offset = eventData.position - (Vector2)minimap.IconsPanel.position + Vector2.one * minimap.MapImageSize / 2f;                 // adding half of map size because draw zone have centered pivot.
                offset /= minimap.GetScaleFactor();

                var boundedMapPos = Minimap.InboundPositionToMap(offset, minimap.MapImageSize);

                Ordering.GiveMapOrder(boundedMapPos);
            }
        }