/// <summary>
        /// 播放背景音乐
        /// </summary>
        /// <param name="clip">音乐剪辑</param>
        /// <param name="isLoop">是否循环</param>
        /// <param name="speed">播放速度</param>
        public void PlayBackgroundMusic(AudioClip clip, bool isLoop = true, float speed = 1)
        {
            if (BackgroundAudio.isPlaying)
            {
                BackgroundAudio.Stop();
            }

            BackgroundAudio.clip  = clip;
            BackgroundAudio.loop  = isLoop;
            BackgroundAudio.pitch = speed;
            BackgroundAudio.Play();
        }
Example #2
0
 /// <summary>
 /// Loads the Play Menu when the Play control is clicked
 /// </summary>
 private void ClickPlayControl(object sender, EventArgs e)
 {
     clickControlSound.Play();
     if (titleMenu.Contains(titleMenu.Controls["PlayMenu"]))
     {
         titleMenu.Controls["PlayMenu"].Visible = true;
     }
     else
     {
         playMenu = new PlayMenu(this);
         playMenu.Load();
     }
 }
Example #3
0
 /// <summary>
 /// This event is called when the mouse clicks on the Back control
 /// </summary>
 private void ClickBackControl(object sender, EventArgs e)
 {
     playMenu.Visible = false;
     clickControlSound.Play();
 }
Example #4
0
 /// <summary>
 /// This event is called when the mouse hovers into the LoadGame control
 /// </summary>
 private void HoverInLoadGameControl(object sender, EventArgs e)
 {
     (playMenu.Controls["Background"]).Controls["LoadGame"].ForeColor = Color.DarkRed;
     (playMenu.Controls["Background"]).Controls["LoadGame"].Location  = new Point(32, 30);
     selectControlSound.Play();
 }
Example #5
0
 /// <summary>
 /// Turns the color of the Play control to Red when mouse hover in
 /// </summary>
 private void HoverInPlayControl(object sender, EventArgs e)
 {
     (titleMenu.Controls["Background"]).Controls["Play"].ForeColor = Color.Red;
     (titleMenu.Controls["Background"]).Controls["Play"].Location  = new Point(155, 210);
     selectControlSound.Play();
 }