public int GetSkillMastery(long skillID) { if (!Learned.Any(x => x.Item1 == skillID)) { return(0); } return(Learned.First(x => x.Item1 == skillID).Item2); }
public void ClearLearnedSkills() { var learnedIDs = Learned.Select(x => x.Item1); Learned.Clear(); foreach (var learnedID in learnedIDs) { Learned.Add(new Tuple <long, int>(learnedID, 0)); } }
public void Learn(GameObject entity) { if (Behaviour == null) { Debug.LogWarning($"Talent {Name} have no behaviour"); } else { entity.GetComponent <BehavioursComponent>().Apply(Behaviour, entity); } IsLearned = true; Learned?.Invoke(this); }
public void UpdateSkillMastery(long skillID, int value, bool additive = false) { int newValue = value; if (Learned.Any(x => x.Item1 == skillID)) { if (additive) { var learned = Learned.First(x => x.Item1 == skillID); newValue += learned.Item2; } Learned.Remove(Learned.First(x => x.Item1 == skillID)); } Learned.Add(new Tuple <long, int>(skillID, newValue)); }