コード例 #1
0
        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;
            }
        }
コード例 #2
0
 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;
 }
コード例 #3
0
        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;
        }
コード例 #4
0
ファイル: TankMachineGun.cs プロジェクト: jenshamren/ShapeTD
 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;
 }
コード例 #5
0
        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();
        }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: TankMachineGun.cs プロジェクト: jenshamren/ShapeTD
 protected override Shape GetProjectileSpawnPoint()
 {
     return((Shape)GameHelper.FindCanvasChild(launcherModel, "projectileSpawnPoint"));
 }
コード例 #8
0
 protected override void Initialize()
 {
     magazine      = new Queue <WeaponProjectile>();
     launcherModel = (Canvas)GameHelper.FindCanvasChild(Holder.Model as Canvas, "waterTurretProjectileLauncher");
 }