Beispiel #1
0
 private void doorUpdate()
 {
     bool clickedThisFrame = false;
     foreach (Door item in doors)
     {
         if (Mousecontrol.clickedOnItem(item.getSprite().Position, item.getSprite().FrameSize, Mousecontrol.clicked()) && !Registry.inventoryInUse)
         {
             if (!item.isLocked)
             {
                 toChangeRoom = true;
                 nextDoor = item;
                 clickedThisFrame = true;
             }
         }
         else if (Mousecontrol.clicked() && !clickedThisFrame)
         {
             toChangeRoom = false;
             //nextDoor = new Door();
         }
     }
     if (toChangeRoom)
     {
         if (Mousecontrol.inProximityToItem(nextDoor.position, new Point(nextDoor.getSprite().FrameSize.X + 2, nextDoor.getSprite().FrameSize.Y + 2)))
         {
             toChangeRoom = false;
             int nextRoomId = int.Parse(nextDoor.nextRoomID);
             Vector2 door2Position = nextDoor.door2Position;
             nextDoor = new Door();
             changeRoom(nextRoomId, door2Position);
         }
     }
 }
Beispiel #2
0
        public static bool rightClickedOnItem(Door door)
        {
            bool rightClickedOnItem = false;

            if (clickedOnItem(door.getSprite().Position, door.getSprite().FrameSize, true))
            {
                rightClickedOnItem = true;
                if (door.isLocked)
                    description = "Locked";
                else
                    description = "Open";
            }

            return rightClickedOnItem;
        }