void btnSell_Click(object sender, ButtonClickEventArgs e) { if (Tower != null) { Tower.Sell(); inputContext.CurrentSprite = null; } }
void btnUpgrade_Click(object sender, ButtonClickEventArgs e) { if (Tower != null) { Tower.Upgrade(); inputContext.CurrentSprite = Tower; } }
void button_Click(object sender, ButtonClickEventArgs e) { if (!Enabled) { return; } if (gameStateManager.CurrentState is ShoppingState) { gameStateManager.ReplaceState <DefendingState>(); } }
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; } } }