예제 #1
0
        //制限時間
        private void timer1_Tick(object sender, EventArgs e)
        {
            SwimFish();

            if (count > 0)
            {
                count--;
                labelTime.Text = $"残り時間:{count/10}秒";
            }
            if (count == 0)
            {
                timer1.Stop();
                if (score != 0)
                {
                    labelTime.Text = "ゲーム終了";
                }
            }

            //昼と夜
            if (count <= 500 && 450 <= count || count <= 350 && 300 <= count || count <= 200 && 150 <= count || 0 < count && count <= 50)
            {
                this.BackColor = Color.Navy;
                utubo.Sleep();
                iwasi.Sleep();
            }
            else
            {
                this.BackColor = Color.DeepSkyBlue;
                utubo.Wake();
                iwasi.Wake();
            }
        }
예제 #2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     swim();
     if (timeleft > 0)
     {
         timeleft       = timeleft - 1.0 / fps;
         labelTime.Text = ((int)timeleft).ToString() + "秒";
         if (dayflg)
         {
             if (daycnt < 10 * fps)
             {
                 daycnt++;
             }
             else
             {
                 dayflg   = false;
                 nightflg = true;
                 iwashi.Sleep();
                 utubo.Sleep();
                 this.BackColor = Color.DarkBlue;
                 daycnt         = 0;
             }
         }
         else if (nightflg)
         {
             if (nightcnt < 5 * fps)
             {
                 nightcnt++;
             }
             else
             {
                 dayflg   = true;
                 nightflg = false;
                 iwashi.Wakeup();
                 utubo.Wakeup();
                 this.BackColor = Color.LightBlue;
                 nightcnt       = 0;
             }
         }
     }
     else
     {
         timer1.Stop();
         MessageBox.Show("時間です。", "終了", MessageBoxButtons.OK, MessageBoxIcon.Information);
         labelTime.Text = "0秒";
         startflg       = false;
         //            buttonStart.Enabled = true;
     }
 }
예제 #3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            remainingTime--;
            labelTime.Text = "残り時間:" + (remainingTime / 10) + "秒";

            if (isDayTime == true)
            {
                daytime--;
                if (daytime == 0)
                {
                    isDayTime = false;
                    iwashi.Sleep();
                    utubo.Sleep();
                    daytime        = 100;
                    this.BackColor = Color.Navy;
                }
            }
            else
            {
                night--;
                if (night == 0)
                {
                    isDayTime = true;
                    iwashi.WakeUp();
                    utubo.WakeUp();
                    night          = 50;
                    this.BackColor = Color.CornflowerBlue;
                }
            }

            if (remainingTime / 10 == 0)
            {
                timer1.Stop();
                labelTime.Text = "ゲームオーバー";
            }
            else
            {
                swim();
            }
        }