public MainWindow() { InitializeComponent(); CreateBoard(xOfBoard, yOfBoard); CreateTablicaTypowPol(); PoleCollection plansza = new PoleCollection(xOfBoard, yOfBoard, tablicaTypowPol); this.traktorek = new Traktor_agent(25, 100, plansza); BoardToTraktor.Children.Add(traktorek.image); dispatcherTimer.Tick += dispatcherTimer_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); dispatcherTimerMoving.Tick += dispatcherTimerMoving_Tick; dispatcherTimerMoving.Interval = new TimeSpan(0, 0, 0, 0, 500); directionX = RandomNumber(1, xOfBoard + 1); directionY = RandomNumber(1, yOfBoard + 1); //trasa = traktorek.AGwiazdka(directionX, directionY); //dispatcherTimer.Start(); changeSeason(); dispatcherTimerToHome.Tick += dispatcherTimerToHome_Tick; dispatcherTimerToHome.Interval = new TimeSpan(0, 0, 0, 0, 500); }
public Traktor_agent(int paliwo_poziom, int paliwo_max, PoleCollection plansza) { this.paliwo_poziom = paliwo_poziom; this.paliwo_max = paliwo_max; this.image.Source = new BitmapImage(new Uri(@"\Images\0.jpg", UriKind.RelativeOrAbsolute)); this.poz_x = 1; this.poz_y = 1; this.jednostkiNawozu = 10; this.plansza = plansza; this.pozycja = plansza.getPole(1, 1); }