示例#1
0
 private void conductNpcSpecificActionsIfNecessary(BoardElement newPosition)
 {
     if (gameEngine.getNpcForCurrentPosition() != null && newPosition != null && !(newPosition is Door) && !(newPosition is ExitDoor) && !(newPosition is Room))
     {
         npcButton.IsEnabled = true;
     }
 }
示例#2
0
文件: Board.cs 项目: paeh/OTMA
        /// <summary>
        /// Prepares the exit door to end the game.
        /// </summary>
        /// <param name="map3x5">The position of the end door</param>
        /// <returns></returns>
        private ExitDoor createExitDoor(BoardElement map3x5)
        {
            var coordinate = new Coordinate(3, 5);
            var exitDoor = new ExitDoor(coordinate, "/OTMA;component/Images/door.png");
            var exitEvent = new Event("Finish", "Finish", "img");
            var exitRoom = new Room(coordinate, "/OTMA;component/Images/finish.png");

            exitDoor.setRoomEvent(exitEvent);
            exitDoor.setBoundaryItems(exitRoom, null, map3x5, null);
            doors.Add(coordinate, exitDoor);

            exitRoom.setHints(ConfigStub.FINAL_HINTS);
            exitRoom.setStories(ConfigStub.FINAL_STORIES);
            exitRoom.setEvent(exitEvent);
            rooms.Add(coordinate, exitRoom);

            return exitDoor;
        }
示例#3
0
文件: Board.cs 项目: paeh/OTMA
        private BoardElement createAndAddBoardElement(int x, int y, String img)
        {
            var coordinate = new Coordinate(x, y);
            var element = new BoardElement(coordinate, img);
            board.Add(coordinate, element);

            return element;
        }
示例#4
0
文件: BoardElement.cs 项目: paeh/OTMA
 /// <summary>
 /// Set the surrounding BoardElements.
 /// </summary>
 /// <param name="north">North neighbour</param>
 /// <param name="east">East neighbour</param>
 /// <param name="south">South neighbour</param>
 /// <param name="west">West neighbour</param>
 public void setBoundaryItems(BoardElement north, BoardElement east, BoardElement south, BoardElement west)
 {
     this.directions.Add(Direction.North, north);
     this.directions.Add(Direction.East, east);
     this.directions.Add(Direction.South, south);
     this.directions.Add(Direction.West, west);
 }
示例#5
0
 private void doDoorRelatedActionsIfNecessary(BoardElement newPosition)
 {
     if (isDoor(newPosition) && hasEvent(newPosition))
         doorLabel.Text = (newPosition as Door).roomEvent.shortTitle;
     else
         doorLabel.Text = "";
 }
示例#6
0
        private Boolean isRoom(BoardElement element)
        {
            if (element is Room)
                return true;

            return false;
        }
示例#7
0
        private Boolean isDoor(BoardElement element)
        {
            if (element is Door)
                return true;

            return false;
        }
示例#8
0
        private Boolean hasEvent(BoardElement element)
        {
            if (isDoor(element) && (element as Door).roomEvent != null)
                return true;

            if (isRoom(element) && (element as Room).roomEvent != null)
                return true;

            return false;
        }
示例#9
0
        private void handleNpcs(BoardElement newPosition)
        {
            if (!isDoor(newPosition) && !isRoom(newPosition))
            {
                var npc = gameEngine.getNpcForCurrentPosition();
                if (npc != null)
                {
                    var imageUri = new Uri(npc.picture, UriKind.Relative);
                    npcImage.Source = new BitmapImage(imageUri);
                    return;
                }
            }

            npcImage.Source = null;
        }
示例#10
0
        private void handleButtons(BoardElement newPosition)
        {
            disableAllMoveButtons();

            foreach (Direction possibleDirection in newPosition.getAvailableDirections())
            {
                enableMoveButton(possibleDirection);
            }
        }
示例#11
0
        private void doRoomRelatedActionsIfNecessary(BoardElement newPosition)
        {
            if (isRoom(newPosition) && hasEvent(newPosition))
            {
                var room = (newPosition as Room);
                eventNameLabel.Text = room.roomEvent.title;
                eventNameLabel.Height = calculateTextboxHeightForCaption(eventNameLabel);

                eventDesciption.Text = room.roomEvent.description;
                eventDesciption.Height = calculateTextboxHeight(eventDesciption);

                eventHintLabel.Text = getRandomRoomContent(room);
                contentTimer.Change(CONTENT_TIMEOUT_IN_SECONDS * 1000, CONTENT_TIMEOUT_IN_SECONDS * 1000);
            }
            else
            {
                eventNameLabel.Text = "";
                eventHintLabel.Text = "";
                eventDesciption.Text = "";
                contentTimer.Change(Timeout.Infinite, Timeout.Infinite);
            }
        }