当前位置: 首页>>代码示例>>C#>>正文


C# MusicPlayer类代码示例

本文整理汇总了C#中MusicPlayer的典型用法代码示例。如果您正苦于以下问题:C# MusicPlayer类的具体用法?C# MusicPlayer怎么用?C# MusicPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MusicPlayer类属于命名空间,在下文中一共展示了MusicPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

	// Use this for initialization
	void Start () {
		musicPlayer = GameObject.FindObjectOfType<MusicPlayer>();

		if ( musicPlayer ) {
			volumeSlider.value = musicPlayer.GetVolume();
		}
	}
开发者ID:dustinbrink,项目名称:unity,代码行数:8,代码来源:OptionsController.cs

示例2: PlayTrack

        public void PlayTrack(Track track)
        {
            var path = Path.Combine (NSBundle.MainBundle.ResourcePath, "testsound.mp3");
            var data = System.IO.File.ReadAllBytes (path);
            var url = NSUrl.FromFilename (path);
            var status = MusicPlayerStatus.Success;
            player = MusicPlayer.Create (out status);
            player.MusicSequence = new MusicSequence ();
            player.MusicSequence.LoadFile (url, MusicSequenceFileTypeID.Any);
            player.Start ();
            /*AppDelegate.Player = AVAudioPlayer.FromUrl (url);
            AppDelegate.Player.NumberOfLoops = 1;

            var res = AppDelegate.Player.PrepareToPlay ();
            //player.AddPeriodicTimeObserver (CoreMedia,CMTime.FromSeconds (1, 1), );

            var r = AppDelegate.Player.Play ();
            AppDelegate.Player.DecoderError += (sender, e) => {
                var a = 3;
            };
            AppDelegate.Player.FinishedPlaying += (sender, e) => {
                var a = 4;
            };
            AppDelegate.Player.BeginInterruption += (sender, e) => {
                var a = 5;
            };
            AppDelegate.Player.EndInterruption += (sender, e) => {
                var a = 6;
            };
            */
        }
开发者ID:Grawl,项目名称:hubbl,代码行数:31,代码来源:iOSPlayerBackend.cs

示例3: Start

	// Use this for initialization
	void Start () {
		// get all the objects we'll need for the cutscene 
		riftParticles = GameObject.Find ("RiftParticles").GetComponent<ParticleSystem>();

		mus = GameObject.Find ("BGM").GetComponent<MusicPlayer>();

		playSound(Rain, true);
	}
开发者ID:metanymie,项目名称:jga,代码行数:9,代码来源:S610Puppeteer.cs

示例4: Start

	// Use this for initialization
	void Start () {
		// get all the objects we'll need for the cutscene 
		LMFB = GameObject.Find ("LMFB");
		Daria = GameObject.Find ("Daria");
		mus = GameObject.Find ("BGM").GetComponent<MusicPlayer>();
		bc = GetComponent<BattleController>();

	}
开发者ID:metanymie,项目名称:jga,代码行数:9,代码来源:S606Puppeteer.cs

示例5: Start

	// Use this for initialization
	void Start () {
		// get all the objects we'll need for the cutscene 
		ChefTony = GameObject.Find ("Chef Tony");
		James = GameObject.Find ("James");

		mus = GameObject.Find ("BGM").GetComponent<MusicPlayer>();

		startTimer();
	}
开发者ID:metanymie,项目名称:jga,代码行数:10,代码来源:S605Puppeteer.cs

示例6: Start

	// Use this for initialization
	void Start () {
		musicPlayer = GameObject.FindObjectOfType<MusicPlayer>();

		if ( musicPlayer ) {
			volumeSlider.value = musicPlayer.GetVolume();
		}

		difficultySlider.value = PlayerPrefsManager.GetDifficulty();
	}
开发者ID:dustinbrink,项目名称:unity,代码行数:10,代码来源:OptionsController.cs

示例7: Start

	// Use this for initialization
	void Start () {
		mp = GameObject.Find("BGM").GetComponent<MusicPlayer>();
		bc = GameObject.Find ("Scripts").GetComponent<BattleController>();

		chefTony = GameObject.Find ("Chef Tony");
		ff = GameObject.Find ("Father Flanagan");
		os = GameObject.Find ("Orphan Shield");
		shoes = GameObject.Find ("ShoesTie");
	}
开发者ID:metanymie,项目名称:jga,代码行数:10,代码来源:S301Puppeteer.cs

示例8: Awake

 void Awake () {
     if (instance != null) {
         Destroy(gameObject);
         Debug.Log("Duplicate MusicPlayer self-destructing!");
     } else {
         instance = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
开发者ID:ukmeth0d,项目名称:Unity-BlockBreaker,代码行数:9,代码来源:MusicPlayer.cs

示例9: Awake

    void Awake()
    {

        if (instance == null)
        {
            instance = this;

        }
        else if (instance != this)
        {
            if (dontDestroy)
            {
                Destroy(gameObject);
            }
            else
            {
                Destroy(instance);
                instance = this;
                initialized = false;
            }

        }
        
        if (dontDestroy)
        {
            DontDestroyOnLoad(gameObject);
        }

    }
开发者ID:ForsakenGS,项目名称:LostKids,代码行数:29,代码来源:MusicPlayer.cs

示例10: Awake

	void Awake () {
		// singleton example code
		if (instance != null && instance != this) {
			//if there is already a music player active
			//just tell *it* to play our song, and then self-destruct

			if((playAtStart && !OnlyPlayIfNoMusicPlaying) ||
			   (playAtStart && OnlyPlayIfNoMusicPlaying && !instance.audio.isPlaying)) {
					instance.PlayMusic(this.music, this.loop);
			} else {
				instance.music = this.music;
			}

			Destroy(this.gameObject);
			return;
		} else {
			instance = this;
		}

		DontDestroyOnLoad(this.gameObject);

		soundSource = gameObject.AddComponent<AudioSource>();
		soundSource.loop = loop;

		if(playAtStart)
			PlayMusic (music, loop);
	}
开发者ID:metanymie,项目名称:jga,代码行数:27,代码来源:MusicPlayer.cs

示例11: Start

    // Use this for initialization
    void Start()
    {
        script = this;
        DontDestroyOnLoad(this.gameObject);

        if (!this.GetComponent<AudioSource>()) this.gameObject.AddComponent<AudioSource>();
        this.audio.loop = true;
    }
开发者ID:joeytsao,项目名称:Game_JIC,代码行数:9,代码来源:MusicPlayer.cs

示例12: Start

 // Use this for initialization
 void Start()
 {
     if (instance != null) {
         Destroy (gameObject);
     }else{
         instance = this;
     }
 }
开发者ID:PaulyWallie,项目名称:PaulyBall,代码行数:9,代码来源:MusicPlayer.cs

示例13: Awake

	// Use this for initialization
	void Awake(){
		if (instance != null) {
			Destroy (gameObject);
		} else {
			instance = this;
			GameObject.DontDestroyOnLoad (gameObject);
		}
	}
开发者ID:srsuttiratana,项目名称:LaserDefender,代码行数:9,代码来源:MusicPlayer.cs

示例14: Start

 void Start()
 {
     if (instance != null && instance != this) {
         Destroy (gameObject);
     } else {
         instance = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
开发者ID:FlorinVasileNechita,项目名称:UnityCourseLaserDefender,代码行数:9,代码来源:MusicPlayer.cs

示例15: Awake

	void Awake () {
		if ( instance != null ) {
			Destroy( gameObject );
			// Debug.Log( "Destroy music player" );
		} else {
			instance = this;
			GameObject.DontDestroyOnLoad( gameObject );
		}
	}
开发者ID:dustinbrink,项目名称:unity,代码行数:9,代码来源:MusicPlayer.cs


注:本文中的MusicPlayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。