void Start() { heightTable = 20; widthTable = 10; pfbBlock = Resources.Load <GameObject> ("prefabs/Block"); //Подгружаем ресурсы spriteDark = Resources.Load <Sprite> ("texture/1"); spriteLight = Resources.Load <Sprite> ("texture/2"); mas[1] = new kvadrat(); mas[2] = new sFigure(); mas[3] = new sFigureReverse(); mas[4] = new gFigure(); mas[5] = new gFigureReverse(); mas[6] = new palochkaFigure(); mas[7] = new tFigure(); randomValue = new float [] { 0.1f, 0.15f, 0.15f, 0.15f, 0.15f, 0.1f, 0.2f, }; Fill(); AddFigure(); Draw(); InvokeRepeating("MoveDown", 1, 0.3f); }
private void narisi() { Image<Gray, byte> kopija = notnoCrtovje.Copy(); int stevecx = 10; int stevecy = 0; List<Znak> zaporedje = nasoZaporedje.getZaporedje(); kvadrateki = new List<kvadrat>(); foreach (Znak trenutni in zaporedje) { if ((690 - stevecx) < trenutni.getSirina()) { stevecx = 10; stevecy += 100; } double trajanje = trenutni.getTrajanje(); if (trenutni.getFrekvenca() != 0) { int koordinatay = trenutni.getKoordinataY(); if (trenutni.getZvisana()) { stevecx += 10; kopija.Draw(new LineSegment2D(new Point(stevecx - 5, koordinatay + stevecy - 2), new Point(stevecx + 5, koordinatay + stevecy - 2)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx - 5, koordinatay + stevecy + 2), new Point(stevecx + 5, koordinatay + stevecy + 2)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx - 2, koordinatay + stevecy - 5), new Point(stevecx - 3, koordinatay + stevecy + 5)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 3, koordinatay + stevecy - 5), new Point(stevecx + 2, koordinatay + stevecy + 5)), new Gray(0), 2); stevecx += 5; } if(koordinatay<30) kopija.Draw(new LineSegment2D(new Point(stevecx + 1, 20 + stevecy), new Point(stevecx + 19, 20 + stevecy)), new Gray(0), 2); if (koordinatay<15) kopija.Draw(new LineSegment2D(new Point(stevecx + 1, 10 + stevecy), new Point(stevecx + 19, 10 + stevecy)), new Gray(0), 2); if (koordinatay > 70) kopija.Draw(new LineSegment2D(new Point(stevecx + 1, 80 + stevecy), new Point(stevecx + 19, 80 + stevecy)), new Gray(0), 2); if (koordinatay > 85) kopija.Draw(new LineSegment2D(new Point(stevecx + 1, 90 + stevecy), new Point(stevecx + 19, 90 + stevecy)), new Gray(0), 2); if (trajanje == 1) { kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 5), new Gray(0), 2); } else if (trajanje == 0.5) { kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 5), new Gray(0), 2); if (koordinatay >= 50) { kopija.Draw(new LineSegment2D(new Point(stevecx + 15, koordinatay + stevecy), new Point(stevecx + 15, koordinatay + stevecy - 20)), new Gray(0), 2); } else { kopija.Draw(new LineSegment2D(new Point(stevecx + 5, koordinatay + stevecy), new Point(stevecx + 5, koordinatay + stevecy + 20)), new Gray(0), 2); } } else if (trajanje == 0.25) { kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 5), new Gray(0), 2); kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 4), new Gray(0), 2); kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 3), new Gray(0), 2); kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 2), new Gray(0), 2); kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 1), new Gray(0), 2); if (koordinatay >= 50) { kopija.Draw(new LineSegment2D(new Point(stevecx + 15, koordinatay + stevecy), new Point(stevecx + 15, koordinatay + stevecy - 20)), new Gray(0), 2); } else { kopija.Draw(new LineSegment2D(new Point(stevecx + 5, koordinatay + stevecy), new Point(stevecx + 5, koordinatay + stevecy + 20)), new Gray(0), 2); } } else if (trajanje == 0.125) { kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 5), new Gray(0), 2); kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 4), new Gray(0), 2); kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 3), new Gray(0), 2); kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 2), new Gray(0), 2); kopija.Draw(new CircleF(new PointF(stevecx + 10, koordinatay + stevecy), 1), new Gray(0), 2); if (koordinatay >= 50) { kopija.Draw(new LineSegment2D(new Point(stevecx + 15, koordinatay + stevecy), new Point(stevecx + 15, koordinatay + stevecy - 20)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 15, koordinatay + stevecy - 20), new Point(stevecx + 25, koordinatay + stevecy - 10)), new Gray(0), 2); } else { kopija.Draw(new LineSegment2D(new Point(stevecx + 5, koordinatay + stevecy), new Point(stevecx + 5, koordinatay + stevecy + 20)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 5, koordinatay + stevecy + 20), new Point(stevecx + 15, koordinatay + stevecy + 10)), new Gray(0), 2); } } } else { if (trajanje == 1) { kopija.Draw(new LineSegment2D(new Point(stevecx + 8, 41 + stevecy), new Point(stevecx + 22, 41 + stevecy)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 8, 42 + stevecy), new Point(stevecx + 22, 42 + stevecy)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 8, 43 + stevecy), new Point(stevecx + 22, 43 + stevecy)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 8, 44 + stevecy), new Point(stevecx + 22, 44 + stevecy)), new Gray(0), 2); } else if (trajanje == 0.5) { kopija.Draw(new LineSegment2D(new Point(stevecx + 8, 49 + stevecy), new Point(stevecx + 22, 49 + stevecy)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 8, 48 + stevecy), new Point(stevecx + 22, 48 + stevecy)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 8, 47 + stevecy), new Point(stevecx + 22, 47 + stevecy)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 8, 46 + stevecy), new Point(stevecx + 22, 46 + stevecy)), new Gray(0), 2); } else if (trajanje == 0.25) { kopija.Draw(new LineSegment2D(new Point(stevecx +16, stevecy+60), new Point(stevecx + 9, stevecy+40)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 9, stevecy + 40), new Point(stevecx + 15, stevecy + 42)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 15, stevecy + 42), new Point(stevecx + 21, stevecy + 40)), new Gray(0), 2); } else if (trajanje == 0.125) { kopija.Draw(new LineSegment2D(new Point(stevecx + 14, stevecy + 60), new Point(stevecx + 21, stevecy + 40)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 9, stevecy + 40), new Point(stevecx + 15, stevecy + 42)), new Gray(0), 2); kopija.Draw(new LineSegment2D(new Point(stevecx + 15, stevecy + 42), new Point(stevecx + 21, stevecy + 40)), new Gray(0), 2); } } kvadrat novi = new kvadrat(stevecx, stevecx + trenutni.getSirina(), 10 + stevecy, 90 + stevecy); kvadrateki.Add(novi); if (trenutni.getZvisana()) stevecx += trenutni.getSirina() - 15; else stevecx += trenutni.getSirina(); } imageBox1.Image = kopija; }