本文整理汇总了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();
}
}
示例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;
};
*/
}
示例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);
}
示例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>();
}
示例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();
}
示例6: Start
// Use this for initialization
void Start () {
musicPlayer = GameObject.FindObjectOfType<MusicPlayer>();
if ( musicPlayer ) {
volumeSlider.value = musicPlayer.GetVolume();
}
difficultySlider.value = PlayerPrefsManager.GetDifficulty();
}
示例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");
}
示例8: Awake
void Awake () {
if (instance != null) {
Destroy(gameObject);
Debug.Log("Duplicate MusicPlayer self-destructing!");
} else {
instance = this;
GameObject.DontDestroyOnLoad(gameObject);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例12: Start
// Use this for initialization
void Start()
{
if (instance != null) {
Destroy (gameObject);
}else{
instance = this;
}
}
示例13: Awake
// Use this for initialization
void Awake(){
if (instance != null) {
Destroy (gameObject);
} else {
instance = this;
GameObject.DontDestroyOnLoad (gameObject);
}
}
示例14: Start
void Start()
{
if (instance != null && instance != this) {
Destroy (gameObject);
} else {
instance = this;
GameObject.DontDestroyOnLoad(gameObject);
}
}
示例15: Awake
void Awake () {
if ( instance != null ) {
Destroy( gameObject );
// Debug.Log( "Destroy music player" );
} else {
instance = this;
GameObject.DontDestroyOnLoad( gameObject );
}
}