Пример #1
0
        // Constructor
        //public Player(string name)
        //{
        //    var inventory = new List<Item>(bagSize);
        //    Name = name;
        //}


        public Player(string name, RNames curRoom, List <Item> inventory)
        {
            this.inventory = inventory;
            Name           = name;
            // CurrentPos = curPos;
            CurRoom = curRoom;
        }
Пример #2
0
 public Door(DStatus stat, INames opener, RNames leadsToRoom)
 {
     // Position = pos;
     Status           = stat;
     CanBeOpenWith    = opener;
     this.LeadsToRoom = leadsToRoom;
 }
Пример #3
0
        public Player(string name, Dir curPos, RNames curRoom, List <Item> inventory)
        {
            this.inventory = inventory;

            // reset the Inventory with some EMPTY items
            //for (int i=0; i < bagSize; i++)
            //{
            //    inventory.Add(new Item("EMPTY", "", INames.EMPTY, ItemPos.NONE));
            //}

            Name       = name;
            CurrentPos = curPos;
            CurRoom    = curRoom;
        }
Пример #4
0
        // Methods

        // Take in the Direction and returns a Message to GameHandler
        // to help the player making next move
        //
        public string Go(Dir dir)
        {
            // Note (int) because dir is enum.
            DStatus doorStatus = LoadGame.rooms[CurRoom].exitDoors[(int)dir].Status;

            // Check first if I can move any direction (if there is a door or a wall)
            // I need the following regardless the position N,E, W,E.

            //
            if (doorStatus == DStatus.WALL)
            {
                msg = "I am sorry, but you hit a Wall!";
            }
            else if (doorStatus == DStatus.Closed)
            {
                msg = "You find a door which is Locked. What would you like to do?";
            }
            // If the players tries to move through an open door, the following will take place
            else
            {
                Console.Clear();
                // NOTE - A bit confusing CurRoom as index and then assigned ;-))

                CurRoom = LoadGame.rooms[CurRoom].exitDoors[(int)dir].LeadsToRoom;                      // Reads from list of rooms to find out where to go

                //ENDROOM
                if (LoadGame.rooms[CurRoom].EndPoint)
                {
                    // Player has completed the game
                    Console.Clear();
                    //string msg1 = "The medallion starts to glow and suddenly you start to levitate.";
                    //string msg2 = "Congratulations you have solved the mystery and will now be set free.";
                    string[] msg =
                    {
                        "You decide to walk through the newly opened doorway, entering the blinding light.",
                        "You're finally able to leave this cursed mansion.",
                        "Congratulations " + Name + ", you solved the mystery!"
                    };
                    for (int i = 0; i < msg.Count(); i++)
                    {
                        GFXText.PrintTxt(-1, 5 + i * 2, Globals.TextTrail, Globals.TextDelay, msg[i], false, false);
                        System.Threading.Thread.Sleep(Globals.SleepTime);
                    }
                    Console.ReadKey();
                    Environment.Exit(0);
                }
                //END OF ENDROOM


                if (LoadGame.rooms[CurRoom].Visited)                                                    // If the new room already visited (player backtracking), text will be printed instantly
                {
                    GFXText.PrintTxt(Globals.RoomNameXPos, Globals.RoomNameYPos, 0, 0, LoadGame.rooms[CurRoom].Name, true, false);
                    //GFXText.PrintTextWithHighlights(LoadGame.rooms[CurRoom].name, Globals.RoomNameXPos, Globals.RoomNameYPos, false);
                    GFXText.PrintTextWithHighlights(LoadGame.rooms[CurRoom].Description, Globals.RoomDescriptionXPos, Globals.RoomDescriptionYPos, false);
                }
                else
                {
                    GFXText.PrintTxt(Globals.RoomNameXPos, Globals.RoomNameYPos, Globals.TextTrail, Globals.TextDelay * 5, LoadGame.rooms[CurRoom].Name, false, false);
                    //GFXText.PrintTextWithHighlights(LoadGame.rooms[CurRoom].name, Globals.RoomNameXPos, Globals.RoomNameYPos, true);          // If the new room is not visited, text will be printed slowly
                    GFXText.PrintTextWithHighlights(LoadGame.rooms[CurRoom].Description, Globals.RoomDescriptionXPos, Globals.RoomDescriptionYPos, true);
                    LoadGame.rooms[CurRoom].Visited = true;
                }
                return(null);
            }
            return(msg);
        }