Пример #1
0
 void btnSell_Click(object sender, ButtonClickEventArgs e)
 {
     if (Tower != null)
     {
         Tower.Sell();
         inputContext.CurrentSprite = null;
     }
 }
Пример #2
0
 void btnUpgrade_Click(object sender, ButtonClickEventArgs e)
 {
     if (Tower != null)
     {
         Tower.Upgrade();
         inputContext.CurrentSprite = Tower;
     }
 }
Пример #3
0
        void button_Click(object sender, ButtonClickEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            if (gameStateManager.CurrentState is ShoppingState)
            {
                gameStateManager.ReplaceState <DefendingState>();
            }
        }
Пример #4
0
        void button_Click(object sender, ButtonClickEventArgs e)
        {
            if (inputContext.State == GameInputContextState.None ||
                inputContext.State == GameInputContextState.Placing)
            {
                // Get tower type
                Type towerType = (Type)((UIElement)sender).Tag;

                // Can the player afford it?
                TowerAttribute attr = (TowerAttribute)towerType.GetCustomAttributes(typeof(TowerAttribute), true).FirstOrDefault();
                if (player.Cash >= attr.Cost)
                {
                    var tower = (Tower)NinjectFactory.Kernel.Get(towerType);
                    tower.Initialize();
                    tower.LoadContent();
                    inputContext.State         = GameInputContextState.Placing;
                    inputContext.CurrentSprite = tower;
                }
            }
        }