//Функција за создавање на објект од класата Night'sWatch повикувана на одреден интервал private void TimerEventNW(Object myObject, EventArgs myEventArgs) { if (lvl1 == true) { Night_sWatch tmp2 = new Night_sWatch(rnd.Next(50, 900), rnd.Next(50, 450)); gm.lista2.Add(tmp2); } else if (lvl2 == true) { t1.Stop(); tt1.Start(); Night_sWatch tmp2 = new Night_sWatch(rnd.Next(50, 900), rnd.Next(50, 450)); gm.lista2.Add(tmp2); } else if (lvl3 == true) { tt1.Stop(); ttt1.Start(); Night_sWatch tmp2 = new Night_sWatch(rnd.Next(50, 900), rnd.Next(50, 450)); gm.lista2.Add(tmp2); } }
public void AddWW(Night_sWatch nw) { lista2.Add(nw); }
private void Form1_MouseClick(object sender, MouseEventArgs e) { strela.Play(); //if (e.X >= eden.x && e.Y >= eden.y && e.X < eden.x + eden.slika.Width && e.Y < eden.y + eden.slika.Height) foreach (WhiteWalker los in (gm.lista1)) { if (e.X >= los.x && e.Y >= los.y && e.X < los.x + 60 && e.Y < los.y + 100) { WW = los; isHit = true; los.zvuk.Play(); score++; } } if (isHit) { gm.lista1.Remove(WW); Invalidate(); } foreach (Night_sWatch nw in gm.lista2) { if (e.X >= nw.x && e.Y >= nw.y && e.X < nw.x + 100 && e.Y < nw.y + 80) { NW = nw; isHit2 = true; nw.zvuk.Play(); score = score - 5; lives--; if (lives == 0) { tTopka.Stop(); topkaCrtaj.Stop(); tWave.Stop(); tLvL.Stop(); t.Stop(); t1.Stop(); t2.Stop(); t3.Stop(); tt.Stop(); tt1.Stop(); tt2.Stop(); tt3.Stop(); ttt.Stop(); ttt1.Stop(); ttt2.Stop(); ttt3.Stop(); this.Hide(); GameOver gmo = new GameOver(); gmo.ShowDialog(); this.Close(); } } } if (isHit2) { gm.lista2.Remove(NW); Invalidate(); } foreach (CannonBall cb in (gm.lista4)) { if (e.X >= cb.x && e.Y >= cb.y && e.X < cb.x + 65 && e.Y < cb.y + 60) { CB = cb; isHit3 = true; //cb.zvuk.Play(); score=score+2; } } if (isHit3) { gm.lista4.Remove(CB); Invalidate(); } }