Example #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);
 }
Example #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;
 }
Example #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);
        }
Example #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));
        }
Example #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);
        }
Example #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);
        }
Example #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);
 }
Example #8
0
 /// <summary>
 /// クリップの削除
 /// </summary>
 /// <param name="clip">クリップ</param>
 /// <returns></returns>
 public bool RemoveClip(SoundClip clip)
 {
     return this.clips.Remove (clip);
 }
Example #9
0
 public MyBall()
 {
     this.chime = new SoundClip ("media/PinPon.wav");
 }