Beispiel #1
0
        public void SetPrintInstructions(PrintInstructions instructions = null)
        {
            PrintInstructions = _rooms.PrintInstructions("");

            Calculator calc = _game.CurrentPlayer.Inventory.Find(item =>
            {
                return(item is Calculator);
            }) as Calculator;

            if (calc != null)
            {
                if (calc.On)
                {
                    PrintInstructions.NewLine();
                    PrintInstructions.AddInstructions(calc.Display);
                }
            }

            if (instructions != null)
            {
                PrintInstructions.NewLine();
                PrintInstructions.AddInstructions(instructions);
            }
        }
Beispiel #2
0
        public MoveResults MovePlayer(Direction direction)
        {
            MoveResults result = MoveResults(direction);

            if (result.Success)
            {
                if (FullyMerged() || Lock.Locked)
                {
                    CurrentRoomPosition = GetAdjoiningRoomPosition(CurrentRoomPosition, direction);
                }
                else
                {
                    switch (Level)
                    {
                    case Types.Level.One:
                        switch (direction)
                        {
                        case Direction.East:
                        case Direction.West:
                            RotateRooms(CurrentRoomPosition, direction);
                            break;

                        case Direction.North:
                        case Direction.South:
                            FlipRooms(direction);
                            break;
                        }
                        break;

                    case Types.Level.Two:
                        switch (direction)
                        {
                        case Direction.North:
                        case Direction.South:
                            RotateRooms(CurrentRoomPosition, direction);
                            break;

                        case Direction.East:
                        case Direction.West:
                            FlipRooms(direction);
                            break;
                        }
                        break;
                    }

                    if (FullyMerged())
                    {
                        AddCards();
                    }
                }
            }

            if (result.Success)
            {
                BaseRoom room = RoomPositions[CurrentRoomPosition];
                result.PrintInstructions.NewLine("You enter the ", ConsoleColor.DarkGreen)
                .Add(RoomInfo[room.Id].Name, room.Color)
                .Add(" room.", ConsoleColor.DarkGreen);
            }

            PrintInstructions mergedMessage = MergedDescription();

            mergedMessage.AddInstructions(result.PrintInstructions);

            result.PrintInstructions = mergedMessage;

            return(result);
        }