/// <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);
        }
Exemple #2
0
 public SkillsetStackEntry(Skillset skillset, BaseFunction strengthFunction, float length, float entryTime, bool ignoreTimeScale)
 {
     Skillset = skillset ?? throw new ArgumentNullException(nameof(skillset));
     SetStrengthFunction(strengthFunction);
     Length          = length;
     EntryTime       = entryTime;
     IgnoreTimeScale = ignoreTimeScale;
 }
Exemple #3
0
 public SkillsetStackEntry(Skillset skillset, string strengthFunction, float length, float entryTime, bool ignoreTimeScale)
 {
     Skillset = skillset ?? throw new ArgumentNullException(nameof(skillset));
     SetStrengthFunction(FunctionSolver.ConvertNestedTermToClassBasedFormat(strengthFunction));
     Length          = length;
     EntryTime       = entryTime;
     IgnoreTimeScale = ignoreTimeScale;
 }
        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);
        }