Exemple #1
0
        public static void CheckAndPickupItem(Universe universe, Adventurer adventurer)
        {
            int checkx = adventurer.Xpos;
            int checky = adventurer.Ypos;

            switch (adventurer.LookDirection)
            {
            case Humanoid.Direction.LEFT:
                checkx--;
                break;

            case Humanoid.Direction.RIGHT:
                checkx++;
                break;

            case Humanoid.Direction.UP:
                checky--;
                break;

            case Humanoid.Direction.DOWN:
                checky++;
                break;

            default:
                break;
            }

            foreach (var item in universe.ItemList)
            {
                if ((item.houseLoc != House.houseName.None) && (item.houseLoc == adventurer.InHouseName))
                {
                    if (!item.itemTaken)
                    {
                        if ((item.XPos == checkx) && (item.YPos == checky))
                        {
                            item.itemTaken = true;
                            adventurer.ItemsDictionary[item.ItemType] += 1;
                            DisplayMap.DisplayItemToPickup(item.XPos, item.YPos, item.itemTaken);
                            TextBoxViews.WriteToMessageBox(universe, "You picked up a " + item.ItemType.ToString());
                        }
                    }
                }
                else if (item.worldLoc == adventurer.MapLocation)
                {
                    if (!item.itemTaken)
                    {
                        //matches locations
                        if ((item.XPos == checkx) && (item.YPos == checky))
                        {
                            item.itemTaken = true;
                            adventurer.ItemsDictionary[item.ItemType] += 1;
                            DisplayMap.DisplayItemToPickup(item.XPos, item.YPos, item.itemTaken);
                            TextBoxViews.WriteToMessageBox(universe, "You picked up a " + item.ItemType.ToString());
                        }
                    }
                }
            }
        }//End of last Method
Exemple #2
0
        /// <summary>
        /// Checks for it3ems then displays them onto the current map you are on
        /// </summary>
        /// <param name="universe"></param>
        /// <param name="adventurer"></param>
        public static void CheckAndDisplayItemMap(Universe universe, Adventurer adventurer)
        {
            bool noMapItems = false;

            foreach (var item in universe.ItemList)
            {
                if ((item.houseLoc != House.houseName.None) && (item.houseLoc == adventurer.InHouseName))
                {
                    if (!item.itemTaken)
                    {
                        DisplayMap.DisplayItemToPickup(item.XPos, item.YPos);
                        noMapItems = true;
                    }
                }
                else if (item.worldLoc == adventurer.MapLocation && !noMapItems)
                {
                    if (!item.itemTaken)
                    {
                        DisplayMap.DisplayItemToPickup(item.XPos, item.YPos);
                    }
                }
            }
        }