Beispiel #1
0
 private void Awake()
 {
     if (theMusic != null)
     {
         Destroy(gameObject);
     }
     else
     {
         theMusic = this;
         DontDestroyOnLoad(gameObject);
     }
 }
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (vreme > 0)            //Uslov za tajmerot, ako vremeto e pogolemo od 0
     {
         vreme = vreme - 1;    //tajmerot go namaluva na interval od 1000 ms
     }
     label1.Text = vreme + ""; //Vremeto se pokazuva ovde
     if (                      //Uslov za uspesno zavrsena igra, ako vremeto e pogolemo od 0 i
         //ako bojata na pozadinata na site kopcinja e zelena
         vreme > 0 && button1.BackColor == Color.Green && button2.BackColor == Color.Green &&
         button3.BackColor == Color.Green && button4.BackColor == Color.Green &&
         button5.BackColor == Color.Green && button6.BackColor == Color.Green &&
         button7.BackColor == Color.Green && button8.BackColor == Color.Green &&
         button9.BackColor == Color.Green && button10.BackColor == Color.Green &&
         button11.BackColor == Color.Green && button12.BackColor == Color.Green &&
         button13.BackColor == Color.Green && button14.BackColor == Color.Green &&
         button15.BackColor == Color.Green && button16.BackColor == Color.Green &&
         button17.BackColor == Color.Green && button18.BackColor == Color.Green &&
         button19.BackColor == Color.Green && button20.BackColor == Color.Green &&
         button21.BackColor == Color.Green && button22.BackColor == Color.Green &&
         button23.BackColor == Color.Green && button24.BackColor == Color.Green &&
         button25.BackColor == Color.Green && button26.BackColor == Color.Green &&
         button27.BackColor == Color.Green && button28.BackColor == Color.Green &&
         button29.BackColor == Color.Green && button30.BackColor == Color.Green &&
         button31.BackColor == Color.Green && button32.BackColor == Color.Green &&
         button33.BackColor == Color.Green && button34.BackColor == Color.Green &&
         button35.BackColor == Color.Green && button36.BackColor == Color.Green)
     {
         label2.Text = "Успешно завршена игра";//Se pokazuva tekst za
         //uspesno zavrsena igra
         timer1.Stop();
         Muzika.close();
     }
     if (//Uslov za nezavrsena igra, ako vremeto dojde do 0 i nema tekst
         //za uspesno zavrsena igra
         vreme == 0 && label2.Text != "Успешно завршена игра")
     {
         label2.Text = "Повеќе среќа следниот пат";
         Muzika.close();
     }
 }