Exemple #1
0
        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();
        }
Exemple #3
0
 internal AddTower(Cell cell, TowerManager towerManager, Canvas canvasMap, Player player, Game game)
 {
     this.cell         = cell;
     this.canvasMap    = canvasMap;
     this.towerManager = towerManager;
     this.player       = player;
     this.game         = game;
     InitializeComponent();
 }