예제 #1
0
 public void Test_RemoveTrack()
 {
     var clip = new SoundClip ("Sound");
     var track1 = new SoundEffectTrack ("PinPon.wav");
     var track2 = new MusicTrack ("nice_music.ogg");
     clip.AddTrack (track1);
     clip.AddTrack (track2);
     clip.RemoveTrack (1);
     clip.RemoveTrack (0);
 }
예제 #2
0
 public MyCharacter()
 {
     this.Speed = 4.0f;
     this.IsGrounded = false;
     this.gravitationalVelocity = new Vector3 (0, 1, 0);
     this.jumpSound = null;
     this.walkUp = null;
     this.walkDown = null;
     this.walkRight = null;
     this.walkLeft = null;
 }
예제 #3
0
        public void Test_New()
        {
            var clip = new SoundClip ("Sound");

            Assert.AreEqual("Sound", clip.Name);
            Assert.AreEqual (0, clip.TrackCount);
            Assert.AreEqual (0, clip.Tracks.Count ());
            Assert.AreEqual (1, clip.Volume);
            Assert.AreEqual (0, clip.Duration);
            Assert.AreEqual (false, clip.IsPlaying);
        }
예제 #4
0
        public void Test_AddTrack()
        {
            var clip = new SoundClip ("Sound");
            var track1 = new SoundEffectTrack ("PinPon.wav");
            var track2 = new MusicTrack ("nice_music.ogg");
            clip.AddTrack (track1);
            clip.AddTrack (track2);

            Assert.AreEqual (2, clip.TrackCount);
            Assert.AreEqual (2, clip.Tracks.Count ());
            Assert.AreEqual (track1, clip.GetTrack (0));
            Assert.AreEqual (track2, clip.GetTrack (1));
        }
예제 #5
0
        public void Test_SetVolume()
        {
            var clip = new SoundClip ("Sound");
            var track1 = new SoundEffectTrack ("PinPon.wav");
            var track2 = new MusicTrack ("nice_music.ogg");
            clip.AddTrack (track1);
            clip.AddTrack (track2);

            clip.Volume = 0.5f;

            Assert.AreEqual (0.5f, clip.Volume);
            Assert.AreEqual (0.5f, track1.Volume);
            Assert.AreEqual (0.5f, track2.Volume);
        }
예제 #6
0
        public void Test_Play_and_Stop()
        {
            var clip = new SoundClip ("Sound");
            var track1 = new SoundEffectTrack ("PinPon.wav");
            var track2 = new MusicTrack ("nice_music.ogg");
            clip.AddTrack (track1);
            clip.AddTrack (track2);

            clip.Play ();
            Assert.AreEqual (true, clip.IsPlaying);
            Assert.AreEqual (true, track1.IsPlaying);
            Assert.AreEqual (true, track2.IsPlaying);

            clip.Stop ();
            Assert.AreEqual (false, clip.IsPlaying);
            Assert.AreEqual (false, track1.IsPlaying);
            Assert.AreEqual (false, track2.IsPlaying);
        }
예제 #7
0
 /// <summary>
 /// クリップの追加
 /// </summary>
 /// <remarks>
 /// すでに登録済みのクリップは無視します。
 /// </remarks>
 /// <param name="clip">クリップ</param>
 /// <param name="playNow">今すぐ再生を始めるフラグ</param>
 public void AddClip(SoundClip clip, bool playNow = false)
 {
     if (clip == null) {
         throw new ArgumentNullException ("Clip is null");
     }
     if (clips.Contains (clip)) {
         return;
     }
     if (playNow) {
         clip.Play ();
     }
     this.clips.Add (clip);
 }
예제 #8
0
 /// <summary>
 /// クリップの削除
 /// </summary>
 /// <param name="clip">クリップ</param>
 /// <returns></returns>
 public bool RemoveClip(SoundClip clip)
 {
     return this.clips.Remove (clip);
 }
예제 #9
0
파일: MyBall.cs 프로젝트: weimingtom/erica
 public MyBall()
 {
     this.chime = new SoundClip ("media/PinPon.wav");
 }