/// <summary> /// Default constructor /// </summary> public Tower() { // Set level this.level = 1; // Create lists this.attackedMonsters = new List<Monster>(); this.bullets = new List<Bullet>(); this.bulletsToDelete = new List<Bullet>(); // No location linked at creation this.location = null; // Counter of ticks for attack at 0 this.attackCounter = 0; // Prepare visual control String image = Map.TowerLocation.BaseFolder + this.image(); // Add visual control to UI Application.Current.Dispatcher.BeginInvoke((Action)delegate() { this.control = new View.Control.TowerControl(image); this.control.changeDelta(36, 50); }); // Add to Tickable list GameEngine.GameManager.Instance.clockRegister(this); }
/// <summary> /// Default constructor /// </summary> /// <param name="towerLocation">tower location on which build a tower</param> public NoTowerMenu(Map.TowerLocation towerLocation) { // GUI init InitializeComponent(); // Associated requester this.towerLocation = towerLocation; // Set default tower this.onTower = 0; // Update max costs this.updateMaxCost(); }
/// <summary> /// Default constructor /// </summary> public TowerLocationControl(Map.TowerLocation owner, String image, double deltaX, double deltaY) { // Visual element initialization InitializeComponent(); // Owner registration this.owner = owner; // Differentials this.deltaX = deltaX; this.deltaY = deltaY; // Image loading this.image.Source = new BitmapImage(new Uri(image)); // Add control to drawing canvas GameEngine.GameManager.Instance.Canvas.Children.Add(this); }
/// <summary> /// Place the tower on a map location /// </summary> /// <param name="location">Location on which place the tower</param> public void place(Map.TowerLocation location) { // Assign location this.location = location; // Move visual control Application.Current.Dispatcher.BeginInvoke((Action)delegate() { this.control.move(this.location.X, this.location.Y); this.control.changeZIndex(this.location.LayerIndex); }); }