public void mouseClick(int x, int y) { for (int i = 0; i < perks.Count; i++) { if (perks[i].mouseOver(x, y, offset)) { if (selectedPerkNode != null) selectedPerkNode.Selected = false; selectedPerkNode = perks[i]; perks[i].Selected = true; } } }
public void showSpecies(Species target) { selectedPerkNode = null; for (int i = 0; i < target.perks.Length; i++) { perks[i].bought = target.perks[i]; perks[i].Selected = false; } if (perks[0].bought) perks[1].blocked = true; else perks[0].blocked = true; }
public Perk add(String name, Vector2 position) { Perk newPerk = new Perk(name, position); //checks to see if the new perk expands the bounds of the entire perk tree and adjusts if (x == 0) //assume this means unitialized { x = (int)position.X; y = (int)position.Y; width = newPerk.width; height = newPerk.height; } else { if (position.X < x) { width = x - (int)position.X + width; x = (int)position.X; } if (position.Y < y) { height = y - (int)position.Y + height; y = (int)position.Y; } if (position.X + newPerk.width - x > width) width = (int)position.X + newPerk.width - x; if (position.Y + newPerk.height - y > height) height = (int)position.Y + newPerk.height - y; } perks.Add(newPerk); newPerk.ID = perks.Count - 1; return newPerk; }