private void PlayPauseButton_MouseDown(object sender, MouseButtonEventArgs e) { Shape playButton = (Shape)GameHelper.FindCanvasChild(playPauseButton, "playButtonModel"); Canvas pauseButton = (Canvas)GameHelper.FindCanvasChild(playPauseButton, "pauseButtonModel"); if (playButton.Visibility == Visibility.Visible) { if (mazeBuilder.IsRunning) { mazeBuilder.Stop(); Grid.UpdateNodes(); PathFinder.FindPath(EnemySpawnPosition, EnemyTargetPosition); } if (PathFinder.Path.Count == 0) { MessageBox.Show("No path was found.", "Path not found!"); mazeBuilder.Start(); return; } WaveSpawner.Start(wavesCleared); UnPause(); playButton.Visibility = Visibility.Hidden; pauseButton.Visibility = Visibility.Visible; } else if (pauseButton.Visibility == Visibility.Visible) { Pause(); playButton.Visibility = Visibility.Visible; pauseButton.Visibility = Visibility.Hidden; } }
protected override void Initialize() { ProjectilesLeftAnimation = new AmmunitionLeftAnimation(Game, this); magazine = new Queue <WeaponProjectile>(); launcherModel = (Canvas)GameHelper.FindCanvasChild(Holder.Model as Canvas, "tankProjectileLauncher"); Magazine.Enqueue(new TankMissileLauncherMissile(Game, this)); Game.PlayArea.MouseMove += PlayArea_MouseMove; }
private void ShowPauseButton() { Shape playButton = (Shape)GameHelper.FindCanvasChild(playPauseButton, "playButtonModel"); Canvas pauseButton = (Canvas)GameHelper.FindCanvasChild(playPauseButton, "pauseButtonModel"); playButton.Visibility = Visibility.Hidden; pauseButton.Visibility = Visibility.Visible; }
protected override void Initialize() { magazine = new Queue <WeaponProjectile>(); ProjectilesLeftAnimation = new AmmunitionLeftAnimation(Game, this); for (int i = 0; i < MagazineSize; i++) { magazine.Enqueue(new TankMachineGunBullet(Game, this)); } launcherModel = (Canvas)GameHelper.FindCanvasChild(Holder.Model as Canvas, "tankProjectileLauncher"); Game.PlayArea.MouseMove += PlayArea_MouseMove; }
private void Initialize() { buyWallModel = (Canvas)game.GameObjectModels["buyWallModel"]; buyWaterTurretModel = (Canvas)game.GameObjectModels["buyWaterTurretModel"]; regretPurchaseModel = (Canvas)game.GameObjectModels["regretPurchaseModel"]; var buyWallText = (TextBlock)GameHelper.FindCanvasChild(buyWallModel, "buyWallTextBlock"); var buyWTurretText = (TextBlock)GameHelper.FindCanvasChild(buyWaterTurretModel, "buyWaterTurretTextBlock"); buyWallText.Text = buyWallText.Text + Wall.GetCost().ToString(); buyWTurretText.Text = buyWTurretText.Text + WaterTurret.GetCost().ToString(); }
private void LoadModels() { Canvas playerGold = (Canvas)GameObjectModels["playerGoldModel"]; playerGoldText = (TextBlock)GameHelper.FindCanvasChild(playerGold, "playerGoldTextBlock"); PlayArea.Children.Add(playerGold); currentLevelText = (TextBlock)GameObjectModels["levelText"]; PlayArea.Children.Add(currentLevelText); playPauseButton = (Canvas)GameObjectModels["playPauseButtonModel"]; PlayArea.Children.Add((Canvas)GameObjectModels["playerHealthModel"]); playerHealthText = (TextBlock)GameHelper.FindCanvasChild((Canvas)GameObjectModels["playerHealthModel"], "playerHealthTextBlock"); PlayArea.Children.Add(playPauseButton); }
protected override Shape GetProjectileSpawnPoint() { return((Shape)GameHelper.FindCanvasChild(launcherModel, "projectileSpawnPoint")); }
protected override void Initialize() { magazine = new Queue <WeaponProjectile>(); launcherModel = (Canvas)GameHelper.FindCanvasChild(Holder.Model as Canvas, "waterTurretProjectileLauncher"); }