/// <summary> /// Place a new entry on the SkillsetStack of this StatMachine. /// </summary> /// <param name="skillset">A Reference to the Skillset which should be added.</param> /// <param name="length">How long will this skillset be added? Pass -1 for infinite duration. /// You can still remove infinite duration SkillStackEntries from the stack by saving the reference returned by this method. /// Use RemoveSkillsetStackEntries(SkillsetStackEntry[]) to remove the created entry using this reference.</param> /// <param name="strengthFunction">A strength modifier, expressed as a function. Use t in this function to get the active time of this SkillsetStackEntry.</param> /// <param name="ignoreTimeScale">Will the time calculation be performed in unscaled time?</param> public SkillsetStackEntry AddSkillsetStackEntry(Skillset skillset, float length, BaseFunction strengthFunction, bool ignoreTimeScale) { SkillsetStackEntry newEntry = CreateIndependentStackEntry(skillset, length, strengthFunction, ignoreTimeScale); AddSkillsetStackEntry(newEntry); return(newEntry); }
/// <summary> /// Adds a finished SkillsetStackEntry to the Stack. /// </summary> /// <param name="Entry">The finished Entry.</param> public void AddSkillsetStackEntry(SkillsetStackEntry Entry) { for (int i = 0; i < SkillsetStack.Count; i++) { if (SkillsetStack[SkillsetStack.Count - i - 1].clippedOnTop == false) { SkillsetStack.Insert(SkillsetStack.Count - i, Entry); return; } } SkillsetStack.Insert(0, Entry); return; }
public SkillsetStackEntry CreateIndependentStackEntry(Skillset skillset, float length, BaseFunction strengthFunction, bool ignoreTimeScale) { SkillsetStackEntry newEntry = new SkillsetStackEntry(skillset, strengthFunction, length, ignoreTimeScale ? Time.realtimeSinceStartup : Time.time, ignoreTimeScale); return(newEntry); }
/// <summary> /// Moves an Entry to the top of the SkillsetStack /// </summary> /// <param name="EntryToMove"></param> public void MoveStackEntryToTop(SkillsetStackEntry EntryToMove) { RemoveSkillsetStackEntries(EntryToMove); SkillsetStack.Add(EntryToMove); }