public void playMusic(eMusic musicToPlay){

		// Si se quiere apagar el audio actual
		if (musicToPlay == eMusic.None) {
			stopMusic();
			return;
		}

		// No se permite reproducir un audio ya en reproduccion
		if (musicToPlay == currentMusic) {
			return;
		}

		// Determinamos el nombre de la cancion
		string musicName = getMusicName (musicToPlay);

		// Cargamos el audio
		AudioClip musicClip = Resources.Load<AudioClip> ("Audio/" + musicName);

		// Pedimos al speaker que lo reproduzca
		speakerMusic.clip = musicClip;
		speakerMusic.Play ();

		// Guardamos el audio en reproduccion
		this.currentMusic = musicToPlay;
	}
Beispiel #2
0
 public void PlaySound(eMusic clipCount, AudioSource audioPlayer, bool isLoop = false)
 {
     audioPlayer.clip = music[(int)clipCount];
     audioPlayer.loop = isLoop;
     audioPlayer.time = 0;
     audioPlayer.Play();
 }
	public void stopMusic(){

		// Detenemos la musica actual
		speakerMusic.Stop();
		speakerMusic.clip = null;
		
		// Ya no hay musica en reproduccion
		this.currentMusic = eMusic.None;
	}
Beispiel #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch      = new SpriteBatch(GraphicsDevice);
            this.sonido      = engine.loadSound("beam.mp3");
            this.instancia   = this.sonido.play3d(0, 0, 0, loopMode.bidiLoop);
            this.yoshimusic  = engine.loadMusic("yoshi.mp3");
            this.fossilMusic = engine.loadMusic("fossil.mp3");


            // TODO: use this.Content to load your game content here
        }
	private string getMusicName(eMusic musicToPlay){
		switch (musicToPlay) {

		// Main
		case eMusic.Home: 					return "MusicHome_Yonna";
		case eMusic.Parents:			 	return "MusicParents_NugambiWarbo";

		// Minigames
		case eMusic.Game2_PuzzleMolas: 		return "MusicGame2PuzzleMolas_Nugambi";
		case eMusic.Game3_Iconography: 		return "MusicGame3Iconography_NaataaYonna";
		case eMusic.Game4_HandicraftsAR:	return "MusicGame4HandicraftsAR_Alduna";
		case eMusic.Game5_Language:	 		return "MusicGame5Language_Takina";

		// Create Story
		case eMusic.Story1_Desierto: 		return "MusicStory1_Desierto";
		case eMusic.Story2_Selva:	 		return "MusicStory2_Selva";
		case eMusic.Story3_Corales:	 		return "MusicStory3_Corales";
		case eMusic.Story4_Andes:	 		return "MusicStory4_Andes";
			
		default: 							return "";
		}
	}
 public void ChangeBGM(eMusic musicIndex) => StartCoroutine(ChangeMusic(dictBGM[musicIndex]));
Beispiel #7
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     gameoversound = globals.engine.loadSound("sounds/gameover.mp3");
     gamemusic     = globals.engine.loadMusic("sounds/34 Docaty Mountain Railroad.mp3");
 }