Beispiel #1
0
        /*!
         * \fn void update()
         * \brief Mise a jour des informations du joueur depuis le modele
         * \param m
         * \return
         */
        public void update()
        {
            updatePosition();

            bool oldArtPossess = shipPossesesArtefact;

            nbArtefacts          = App.wrapper.getPlayerNbArtefacts(playerNb);
            shipPossesesArtefact = App.wrapper.getPlayerPossesArtefact(playerNb);

            int oldShotsRemaining = shotsRemaining;

            shotsRemaining = App.wrapper.getPlayerShotsRemaining(playerNb);
            if (shotsRemaining > oldShotsRemaining)
            {
                mainGame.write(mainGame.strColorTab[playerNb] + " spaceship's laser canon is now fully loaded");
                player = new WMPLib.WindowsMediaPlayer();
                var path = System.IO.Path.Combine(
                    System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
                    , "sounds/energy.mp3");
                player.URL = path;
                player.controls.play();
            }

            if (!oldArtPossess && shipPossesesArtefact)
            {
                mainGame.write("A PascalGarcium ore is loaded in spaceship " + mainGame.strColorTab[playerNb]);
                player = new WMPLib.WindowsMediaPlayer();
                var path = System.IO.Path.Combine(
                    System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
                    , "sounds/getartefact.mp3");
                player.URL = path;
                player.controls.play();
            }
            if (oldArtPossess && !shipPossesesArtefact)
            {
                player = new WMPLib.WindowsMediaPlayer();
                var path = System.IO.Path.Combine(
                    System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
                    , "sounds/wonartefact.mp3");
                player.URL = path;
                player.controls.play();
                mainGame.write("A PascalGarcium ore is brought back by player " + mainGame.strColorTab[playerNb]);
            }
            Utilities.GameColors color = (Utilities.GameColors)App.wrapper.getColorTab(playerNb);

            mainGame.textBlockArtefactsTab[(int)color].Text = nbArtefacts.ToString();
            mainGame.textBlockShotsTab[(int)color].Text     = shotsRemaining.ToString();
            updateSpaceshipType();
            updateImage();
        }
 public void colorTypeToStringTest()
 {
     Utilities.GameColors i = new Utilities.GameColors();
     i = Utilities.GameColors.Blue;
     string expected = "Blue"; // TODO: initialisez a une valeur appropriee
     string actual;
     actual = Utilities.colorTypeToString(i);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("color blue");
     i = Utilities.GameColors.Red;
     actual = Utilities.colorTypeToString(i);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("color red");
 }
        public void colorTypeToStringTest()
        {
            Utilities.GameColors i = new Utilities.GameColors();
            i = Utilities.GameColors.Blue;
            string expected = "Blue"; // TODO: initialisez a une valeur appropriee
            string actual;

            actual = Utilities.colorTypeToString(i);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("color blue");
            i      = Utilities.GameColors.Red;
            actual = Utilities.colorTypeToString(i);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("color red");
        }