private void DisplayNewButtons() { if (CurrentlySelected == null) { return; } ButtonsToDisplay.Clear(); Tower s = CurrentlySelected; //s.DrawRange = false; Vector2 DisplayLocation = WritingLocation; foreach (Edge e in s.TowersThisCanBeUpgradedInto) { if (s.TowerName != e.Destination.TowerName) { Tower T = e.Destination; SpriteAnimation anim = new SpriteAnimation(T.ButtonImage); anim.AddAnimations("Default", new FrameAnimation(1, T.ButtonImage.Width, T.ButtonImage.Height, 1, 0, 0, new Point(1, 1))); ButtonTower b = new ButtonTower(anim, DisplayLocation, T, e.GoldCost); ButtonsToDisplay.Add(b); DisplayLocation.X += b.spriteAnimation.CurrentAnimation.CurrentRect.Width + 2; } } }
private void DisplayDefault() { ButtonsToDisplay.Clear(); Tower t = TowerGraph.Search(DefaultTowerName); SpriteAnimation anim = new SpriteAnimation(t.ButtonImage); anim.AddAnimations("Default", new FrameAnimation(1, t.ButtonImage.Width, t.ButtonImage.Height, 1, 0, 0, new Point(1, 1))); ButtonTower b = new ButtonTower(anim, new Vector2(WritingLocation.X, WritingLocation.Y), t, DefaultTowerCost); ButtonsToDisplay.Add(b); }