private void Window_Loaded(object sender, RoutedEventArgs e) { //CancellationToken token = cancellationTokenSource.Token; CreateLevel(); LoadWaypoints(); player = new Player(); waveManager = new WaveManager(wayPoints, CanvasMap, this); towerManager = new TowerManager(waveManager, waveManager.WavesSpawn); //playerThread = new Thread(() => //{ player.timerPlayerStart(); Application.Current.Dispatcher.Invoke((Action)(() => { MoneyLabel.Content = player.Money; })); player.onCount += ChangedMoney_onCount; //}); //playerThread.Start(); waveManager.StartWaveSpawner(); towerManager.ActivateTowers(); timerEnemiesStart(); //var task = new Thread(async () => await TestAsync(token)); //task.Start(); //await TestAsync(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { CreateLevel(); wayPoints = LoadWaypoints(allCells, firstCell, fieldWidth, fieldHeight, currWayX, currWayY); player = new Player(); waveManager = new WaveManager(wayPoints, CanvasMap, this); towerManager = new TowerManager(waveManager, waveManager.WavesSpawn); MoneyLabel.Content = player.Money; player.OnCount += ChangedMoney_onCount; playerThread = new Thread(() => { player.TimerPlayerStart(); }); playerThread.Start(); towersThread = new Thread(() => { towerManager.ActivateTowers(); }); towersThread.Start(); waveManager.StartWaveSpawner(); timerEnemiesStart(); }