Esempio n. 1
0
        public void PlayerTest()
        {
            var player = new HuntTheWumpus.Player();
            int mem    = player.Coins;

            player.AddCoins(100);
            player.AddCoins(0);
            Assert.True(mem + 100 == player.Coins, "AddCoins isn't correct");
            mem += 100;
            player.BuyArrows();
            Assert.True(mem > player.Coins, "BuyArrow isn't correct");
            mem = player.Coins;
            player.BuyHint();
            Assert.True(mem > player.Coins, "BuyHint isn't correct");
            int ch = 0;

            while (player.CanBuyArrow() && ch < 1000)
            {
                player.BuyArrows();
                ++ch;
            }
            Assert.True(ch < 1000, "CanBuyArrow isn't correct");
            player.AddCoins(100);
            ch = 0;
            while (player.CanBuyHint() && ch < 1000)
            {
                player.BuyHint();
                ++ch;
            }
            Assert.True(ch < 1000, "CanBuyHint isn't correct");
        }
Esempio n. 2
0
        public void movePlayer(Player player, List<Room> rooms)
        {
            Random rand = new Random();
            int i = rand.Next(0, rooms.Count - 1);

            //Console.WriteLine("Bat.movePlayer() : " + name + " is carrying " + player.name + " to Room " + rooms[i].id);
            player.move(rooms[i]);
            Console.WriteLine("You watch the superbat fly away into the darkness...");
            i = rand.Next(0, rooms.Count - 1); // make the bat move somewhere new as well
            move(rooms[i]);
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //TestCave testCave = new TestCave();
            //TestPlayer testplayer = new TestPlayer();
            //TestPlayerRoom testplayerroom = new TestPlayerRoom();
            //TestArrow testarrow = new TestArrow();
            //TestRoom testroom = new TestRoom();

            /*real gameplay stuff */
            numBats = numPits = 2;

            initCave();
            input = new InputProcessor(rooms);
            player = new Player("Hunter");
            wumpus = new Wumpus("Wumpy");
            bats = new List<Bat>(numBats);
            pits = new List<Pit>(numPits);
            //init bats & pits
            for (int i = 0; i < numPits;i++ )
            {
                Bat bat = new Bat(i.ToString());
                bats.Add(bat);
                Pit pit = new Pit(i);
                pits.Add(pit);
            }

            positions = new int[6]; //hard coded 6 entities... >_<
            setup(1);

            base.Initialize();
        }
Esempio n. 4
0
 public void kill(Player player)
 {
     player.die();
 }
Esempio n. 5
0
 public void kill(Player player)
 {
     player.die();
     Console.WriteLine("Ooh! The Wumpus got ya!");
 }