Example #1
0
        void TryToSelectObject(Vector3 pointerPos, MapSelectionType mapSelectionType)
        {
            selectionRay = mapOrderCamera.ScreenPointToRay(pointerPos);

            if (!Physics.Raycast(selectionRay, out var hitInfo))
            {
                return;
            }

            if (hitInfo.collider.CompareTag(HOUSE_TAG))
            {
                var hitTransform = hitInfo.transform;

                if (!CanSetCurrentlyHighlightedObject(hitTransform) || highlightedHouse == selectedHouse)
                {
                    return;
                }

                SetStatusOfPointedObject(mapSelectionType);
            }
            else
            {
                TryToResetSelection(mapSelectionType);
            }
        }
Example #2
0
 void SetStatusOfPointedObject(MapSelectionType mapSelectionType)
 {
     if (mapSelectionType == MapSelectionType.Selection)
     {
         TryToSetSelectedObject();
     }
     else
     {
         highlightedHouse.ManageSelectedHouse(MapSelectionType.Highlight);
     }
 }
Example #3
0
        void TryToResetSelection(MapSelectionType mapSelectionType)
        {
            if (highlightedHouse != null && highlightedHouse != selectedHouse)
            {
                highlightedHouse.ManageSelectedHouse(MapSelectionType.Undefined);
            }

            if (mapSelectionType != MapSelectionType.Selection || selectedHouse == null)
            {
                return;
            }

            selectedHouse.ManageSelectedHouse(MapSelectionType.Undefined);
            highlightedHouse = null;
            selectedHouse    = null;
            TweenUIAnimations.MoveDown(mapView.BottomBar);
        }
Example #4
0
        public UIMapSelection(Vector2 position, MapSelectionType thisType)
        {
            Vector2 size = Vector2.Zero;

            if (thisType == MapSelectionType.TravelLoc)
            {
                size            = new Vector2(100, 100);
                travelCollision = new Rectangle((int)(position.X + locationOffset.X), (int)(position.Y + locationOffset.Y), 100, 25);
                infoCollision   = new Rectangle((int)(position.X + locationOffset.X), (int)(position.Y + 25 + locationOffset.Y), 100, 25);
            }
            else if (thisType == MapSelectionType.CurrentLoc)
            {
                size          = new Vector2(100, 100);
                restCollision = new Rectangle((int)(position.X + locationOffset.X), (int)(position.Y + locationOffset.Y), 100, 25);
                infoCollision = new Rectangle((int)(position.X + locationOffset.X), (int)(position.Y + 25 + locationOffset.Y), 100, 25);
            }

            thisMapSelectionType = thisType;

            thisGridLocation = new Point((int)(position.X / 64), (int)(position.Y / 64));

            uiMapSelectionPosition = new Rectangle((int)(position.X + locationOffset.X), (int)(position.Y + locationOffset.Y), (int)size.X, (int)size.Y);
        }
Example #5
0
 public static void BroadcastOnSelect(Vector3 pointerPos, MapSelectionType selection)
 {
     OnSelect?.Invoke(pointerPos, selection);
 }