public void OnSelect(BaseEventData eventData) { AttacksDatabase ad = AttacksDatabase.Instance; TreeNode node = this.treeHandler.GetTreeNode(this.treeNodeId); Attack attack = ad.GetAttack(node.Skill_ID); if (node == null || attack == null) { ButtonImage.color = this.highlightedColour; } this.treeHandler.CenterSkillTreeAt(gameObject.transform.localPosition); string tooltipText = "<color=#00ff00ff><b>" + attack.Name + "</b></color>" + "\n\n" + attack.Description + "\n\nUNLOCKED"; if (!node.IsUnlocked) { tooltipText = "<color=#800000ff><b>" + attack.Name + "</b></color>" + "\n\n" + attack.Description + "\n\nCosts: " + node.Cost + " skillpoints" + "\n\n"; if (node.Skill_Dependency.Length > 0) { tooltipText += "Requirements:\n"; foreach (int dependency in node.Skill_Dependency) { TreeNode dependencyNode = this.treeHandler.GetTreeNode(dependency); Attack dependencyAttack = ad.GetAttack(dependencyNode.Skill_ID); if (node == null || dependencyAttack == null) { continue; } if (dependencyNode.IsUnlocked) { tooltipText += "<color=#00ff00ff>"; } else { tooltipText += "<color=#ff0000ff>"; } tooltipText += dependencyAttack.Name; if (dependencyNode.IsUnlocked) { tooltipText += "</color> - Unlocked"; } else { tooltipText += "</color>- Not Unlocked"; } tooltipText += "\n\n"; } } if (this.treeHandler.CanSkillBeUnlocked(this.treeNodeId)) { tooltipText += "<i>Press Enter to Unlock.</i>"; } else { tooltipText += "<i>You dont have enough skillpoints to unlock this spell.</i>"; } } this.treeHandler.SetTooltipText(tooltipText); this.treeHandler.ShowTooltipAt(true, this.transform); }
public void UnlockTrait(TreeNode tn) { data_.unlockedTreeSkills.Add(tn.Tree_ID); AttacksDatabase attackDatabase = AttacksDatabase.Instance; if (!attackDatabase) { Debug.LogError("No AttackDatabase in this scene or the AttackDatabase has an incorrect tag."); return; } data_.atacks.Add(attackDatabase.GetAttack(tn.Skill_ID)); }