public void AddStatDependency(StatBase statToAdd, float multiplier)
        {
            var statInDepList    = StatsDependingOn.Find(x => x.StatDependingOn == statToAdd);
            var createNewStatDep = ReferenceEquals(statInDepList, null);

            if (createNewStatDep)
            {
                var statDep = new StatDependency(statToAdd, multiplier);
                isDirty = true;

                StatsDependingOn.Add(statDep);

                statToAdd.statWasModified += DependenciesWereModified;
            }
        }
        public bool RemoveStatDependency(StatBase statToRemove)
        {
            var statDep = StatsDependingOn.Find(x => x.StatDependingOn == statToRemove);
            var statIsntInDependencies = ReferenceEquals(statDep, null);

            if (statIsntInDependencies)
            {
                return(false);
            }

            isDirty = true;

            statToRemove.statWasModified -= DependenciesWereModified;

            return(StatsDependingOn.Remove(statDep));
        }
示例#3
0
 public StatDependency(StatBase statDependingOn, float statMultiplier)
 {
     this.statDependingOn = statDependingOn;
     this.statMultiplier  = statMultiplier;
 }