Example #1
0
 private void BuyWaterTurretModel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (currentStructure == null && game.PlayerCash >= WaterTurret.GetCost())
     {
         currentStructure = PurchaseStructure(typeof(WaterTurret));
     }
 }
Example #2
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();
        }
Example #3
0
 private void Form_KeyDown(object sender, KeyEventArgs e)
 {
     if (currentStructure == null && e.Key == Key.D && game.PlayerCash >= Wall.GetCost())
     {
         currentStructure = PurchaseStructure(typeof(Wall));
     }
     if (currentStructure == null && e.Key == Key.F && game.PlayerCash >= WaterTurret.GetCost())
     {
         currentStructure = PurchaseStructure(typeof(WaterTurret));
     }
     if (e.Key == Key.B)
     {
         RegretPurchase();
     }
     if (e.Key == Key.Tab)
     {
         RotateWall(currentStructure as Wall);
     }
 }
Example #4
0
 private IStructure PurchaseStructure(Type structureType)
 {
     if (structureType == typeof(Wall))
     {
         Wall wall = CreateWall();
         game.AddGameObject(wall as MovableGameObject);
         game.PlayerCash -= wall.Cost;
         return(wall);
     }
     else if (structureType == typeof(WaterTurret))
     {
         WaterTurret turret = new WaterTurret(game);
         turret.Model.MouseDown += currentStructure_MouseDown;
         turret.MoveToPoint(GetCenterToCursor(turret));
         game.AddGameObject(turret);
         game.PlayerCash -= turret.Cost;
         return(turret);
     }
     return(null);
 }
 public WaterTurretLauncher(GameController game, WaterTurret holderTurret) : base(game, holderTurret)
 {
 }