Beispiel #1
0
 /// <summary>
 /// Creates a new StatMachine and registers it in the system. It can be found again using its Owner or by using the reference returned by this method.
 /// </summary>
 /// <param name="Owner">The Owner of the created StatMachine.</param>
 public StatMachine CreateStatMachine(StatEntity Owner, Statset Statset)
 {
     if (!StatMachines.ContainsKey(Owner))
     {
         StatMachine newMachine = new StatMachine(Owner, Statset);
         StatMachines.Add(Owner, newMachine);
         return(newMachine);
     }
     Debug.LogError("Only one stat machine per owner allowed: <b>" + Owner.ToString() + "</b> already controls a stat machine.");
     return(null);
 }
 /// <summary>
 /// Overwrites all stats in the given statset with their values calculated after applying the passed StackEntries.
 /// </summary>
 /// <param name="Statset">The name of the Statset to apply to.</param>
 /// <param name="Stack">The SkillsetStackEntries that will be applied to the Statset.</param>
 public void Apply(Statset statset, bool AutomaticallyRemove, params SkillsetStackEntry[] Stack)
 {
     foreach (Stat ApplyToStat in statset.Data.Values)
     {
         ApplyToStat.OverwriteValue(EvaluateStat(ApplyToStat, new List <SkillsetStackEntry>(Stack)));
     }
     if (AutomaticallyRemove)
     {
         foreach (SkillsetStackEntry Entry in Stack)
         {
             SkillsetStack.Remove(Entry);
         }
     }
 }
 public StatMachine(StatEntity owner, Statset statset)
 {
     Owner   = owner;
     Statset = statset;
 }