private void StartAnimation() { smallBoard.Isvalymas(); GeneruotiDetales(); d = BusimaDetale; BusimaDetale = RandomDetale(); foreach (var koord in d.LangeliuKoord) { myBoard.NuspalvintLangeli(Convert.ToInt32(koord.X), Convert.ToInt32(koord.Y), d.Spalva); } foreach (var koord in BusimaDetale.LangeliuKoord) { smallBoard.NuspalvintLangeliSmall(Convert.ToInt32(koord.X), Convert.ToInt32(koord.Y), BusimaDetale.Spalva); } if (!d.ArLieciaDetalesApacia(myBoard.UzimtiLangeliai)) // tikrinam, ar tik atsiradus detalei ji nera ant kitos detales { t = new DispatcherTimer(); t.Tick += t_Tick; t.Interval = new TimeSpan(0, 0, 0, 0, 250); t.Start(); } else { t.Stop(); arGameOver = true; GameOver GameOver = new GameOver(Menu, Taskai, this); GameOver.Show(); } }
public Detale RandomDetale() { Random rnd = new Random(); Detale d = new Detale(); int indeksas = rnd.Next(VisosDetales.Count); d = VisosDetales[indeksas]; return(d); }
private void Window_Loaded_1(object sender, RoutedEventArgs e) { KeyDown += MainWindow_KeyDown; myBoard.myCnv = myCanvas; smallBoard.myCnv = myCanvas1; myBoard.PiestiPagrindineLenta(); smallBoard.PiestiSalutineLenta(); GeneruotiDetales(); BusimaDetale = RandomDetale(); StartAnimation(); }
public void GeneruotiDetales() { VisosDetales.Clear(); Detale d1 = new Detale(); d1.LangeliuKoord.Add(new Point(1, 4)); d1.LangeliuKoord.Add(new Point(1, 5)); d1.LangeliuKoord.Add(new Point(1, 6)); d1.LangeliuKoord.Add(new Point(1, 7)); d1.DetalesNr = 1; d1.PasukimoKampas = 0; d1.Spalva = Colors.Cyan; Detale d2 = new Detale(); d2.LangeliuKoord.Add(new Point(2, 6)); d2.LangeliuKoord.Add(new Point(1, 6)); d2.LangeliuKoord.Add(new Point(1, 5)); d2.LangeliuKoord.Add(new Point(1, 4)); d2.DetalesNr = 2; d2.PasukimoKampas = 0; d2.Spalva = Colors.Blue; Detale d3 = new Detale(); d3.LangeliuKoord.Add(new Point(2, 4)); d3.LangeliuKoord.Add(new Point(1, 4)); d3.LangeliuKoord.Add(new Point(1, 5)); d3.LangeliuKoord.Add(new Point(1, 6)); d3.DetalesNr = 3; d3.PasukimoKampas = 0; d3.Spalva = Colors.Orange; Detale d4 = new Detale(); d4.LangeliuKoord.Add(new Point(2, 6)); d4.LangeliuKoord.Add(new Point(2, 5)); d4.LangeliuKoord.Add(new Point(1, 5)); d4.LangeliuKoord.Add(new Point(1, 6)); d4.DetalesNr = 4; d4.PasukimoKampas = 0; d4.Spalva = Colors.Yellow; Detale d5 = new Detale(); d5.LangeliuKoord.Add(new Point(2, 6)); d5.LangeliuKoord.Add(new Point(2, 5)); d5.LangeliuKoord.Add(new Point(1, 5)); d5.LangeliuKoord.Add(new Point(1, 4)); d5.DetalesNr = 5; d5.PasukimoKampas = 0; d5.Spalva = Colors.Red; Detale d6 = new Detale(); d6.LangeliuKoord.Add(new Point(2, 5)); d6.LangeliuKoord.Add(new Point(1, 5)); d6.LangeliuKoord.Add(new Point(1, 4)); d6.LangeliuKoord.Add(new Point(1, 6)); d6.DetalesNr = 6; d6.PasukimoKampas = 0; d6.Spalva = Colors.Purple; Detale d7 = new Detale(); d7.LangeliuKoord.Add(new Point(2, 4)); d7.LangeliuKoord.Add(new Point(2, 5)); d7.LangeliuKoord.Add(new Point(1, 5)); d7.LangeliuKoord.Add(new Point(1, 6)); d7.DetalesNr = 7; d7.PasukimoKampas = 0; d7.Spalva = Colors.LimeGreen; Detale d8 = new Detale(); d8.LangeliuKoord.Add(new Point(1, 5)); d8.LangeliuKoord.Add(new Point(1, 4)); d8.LangeliuKoord.Add(new Point(1, 6)); d8.LangeliuKoord.Add(new Point(2, 4)); d8.LangeliuKoord.Add(new Point(2, 6)); d8.DetalesNr = 8; d8.PasukimoKampas = 0; d8.Spalva = Colors.DarkKhaki; VisosDetales.Add(d1); VisosDetales.Add(d2); VisosDetales.Add(d3); VisosDetales.Add(d4); VisosDetales.Add(d5); VisosDetales.Add(d6); VisosDetales.Add(d7); VisosDetales.Add(d8); }