Example #1
0
        /// <summary>
        ///     Updates the state of the game on the map.
        /// </summary>
        public void Update()
        {
            Console.WriteLine();
            Wumpus.Update(this);

            HashSet <int> roomsAdjacentToPlayer = Rooms[Player.RoomNumber];

            _hazards.ForEach(
                h => {
                if (roomsAdjacentToPlayer.Contains(h.RoomNumber))
                {
                    h.PrintHazardWarning();
                }
            });
            Player.PrintLocation();
        }
Example #2
0
        public void Update()
        {
            var adjRooms = getAdjacentRooms(Player.Position);

            // Update Wumpus first
            Wumpus.Update();

            // Check for adjacent hazards (in entity updates)
            foreach (Entity entity in Entities)
            {
                entity.Update();
            }

            // Tell the player where they are
            Console.WriteLine("You are in room {0}", Player.Position);
            Console.WriteLine("Tunnels lead to {0} {1} {2}", adjRooms[0], adjRooms[1], adjRooms[2]);

            // Do player actions
            Player.Update();

            // At the end of turn, check if anything in the same room as player
            HazardCheck();
        }