Example #1
0
        public void SetUpGame()
        {
            CreatePlayer();
            CreateWorld();
            InitialPrint();

            void InitialPrint()
            {
                Console.WriteLine();
                Console.Write("              ");
                TextUtils.AnimateText("Dungeons of Doom", 200);
                TextUtils.AnimateText("...", 600);
                Console.ReadKey();
            }

            void CreatePlayer()
            {
                player = new Player(50, 0, 0);
            }

            void CreateWorld()
            {
                world = new Room[WorldWidth, WorldHeight];

                for (int y = 0; y < world.GetLength(1); y++)
                {
                    for (int x = 0; x < world.GetLength(0); x++)
                    {
                        world[x, y] = new Room();

                        if (x != 0 && y != 0)
                        {
                            int randResult = RandomUtils.OneToCustomRnd(100);

                            if (randResult < 5)
                            {
                                world[x, y].Monster = new Skeleton(30);
                            }
                            else if (randResult < 10)
                            {
                                world[x, y].Monster = new Orc(50);
                            }
                            else if (randResult < 15)
                            {
                                world[x, y].Item = new Sword();
                            }
                            else if (randResult < 20)
                            {
                                world[x, y].Item = new Axe();
                            }
                            else if (randResult < 25)
                            {
                                world[x, y].Item = new Potion();
                            }
                            else if (randResult < 40)
                            {
                                world[x, y].Obstacle = new Obstacle();
                            }
                        }
                    }
                }
            }
        }