コード例 #1
0
 public int GetSkillMastery(long skillID)
 {
     if (!Learned.Any(x => x.Item1 == skillID))
     {
         return(0);
     }
     return(Learned.First(x => x.Item1 == skillID).Item2);
 }
コード例 #2
0
        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));
            }
        }
コード例 #3
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);
        }
コード例 #4
0
        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));
        }