コード例 #1
0
        /// <summary>
        /// Tocar musica durante a batalha
        /// </summary>
        private void InicarMusicaBatalha()
        {
            //Musica de inimigos normis
            string music = "themeBattle.mp3";

            //musica do boss final
            if (monstro.GetType() == typeof(Anaculo))
            {
                music = "themeFinalBoss.mp3";
            }
            //Musica dos outros bosses
            else if (monstro.GetType() == typeof(Atom) || monstro.GetType() == typeof(Lapain) || monstro.GetType() == typeof(Toest))
            {
                music = "themeBoss.mp3";
            }

            try
            {
                Uri pathUri = new Uri("ms-appx:///Assets/Musicas/" + music);
                musicBattle        = new MediaPlayer();
                musicBattle.Source = MediaSource.CreateFromUri(pathUri);
                musicBattle.Play();
                Debug.Write("Som foi execultado");
            }
            catch (Exception ex)
            {
                if (ex is FormatException)
                {
                    Debug.Write("erro ao execultar som");
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Define a imagem do monstro na tela de combate
        /// </summary>
        private void ImgMonstroCombate(Monstro monstro)
        {
            string diretorioMonstro;

            //Definir a imagem do mosntro
            if (monstro.GetType() == typeof(Aculo))
            {
                diretorioMonstro = "monstros/aculo.png";
            }
            else if (monstro.GetType() == typeof(Anaculo))
            {
                diretorioMonstro = "monstros/anaculo.png";
            }
            else if (monstro.GetType() == typeof(Atom))
            {
                diretorioMonstro = "monstros/atom.png";
            }
            else if (monstro.GetType() == typeof(Gasefic))
            {
                diretorioMonstro = "monstros/gasefic.png";
            }
            else if (monstro.GetType() == typeof(Lapain))
            {
                diretorioMonstro = "monstros/lapain.png";
            }
            else if (monstro.GetType() == typeof(Minlapa))
            {
                diretorioMonstro = "monstros/minlapa.png";
            }
            else if (monstro.GetType() == typeof(Mintost))
            {
                diretorioMonstro = "monstros/mintost.png";
            }
            else //Toest
            {
                diretorioMonstro = "monstros/toest.png";
            }
            ImgMonstro.Source = new BitmapImage(new Uri("ms-appx:///Assets/" + diretorioMonstro));
        }