Class SkillUserBehaviour
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
public class SkillUserBehaviour : MonoBehaviour
- Inheritance
-
objectSkillUserBehaviour
Fields
- CurrentlyUsedSkill
The skill currently running, if any. One slot, because only one skill runs at a time.
- SkillFinished
Raised when a skill stops running (finished or interrupted).
- StartingSkillTypeNames
Skills this character owns from the start, by type name —
"Fireball"or"Fireball:3". A prefab used to supply these by carrying the skill component; a plain class cannot be serialised into a prefab, so the prefab names its skills instead.
- _skills
The character's skills. Runtime only — a skill is a plain class, so Unity has nothing to serialise here; a prefab names its starting skills in StartingSkillTypeNames instead. Observable so the OneJS UI subscribes to
Changed(useObservableList) instead of polling the list on a timer — every mutation goes through the list, so the event always fires.
Properties
Methods
- AddSkill(Skill)
Adds a skill to the character. A character owns at most one instance of a type, so re-adding one it already has returns that instance: UseSkill(Skill, bool) hands back the skill it was given on every use, and the create-then-add callers (books, scrolls, save load) should never end up with a second copy. Master's version had the same guard as a SkillContainer parent check. A buff that is already present is refreshed/stacked instead of being duplicated.
- ClearAllSkills()
Drops every skill and buff at once. Both lists have to go together: a buff left behind in _buffs would answer GetBuff<T>() for a skill the character no longer has. No OnRemoved() callbacks — this is for rebuilding a character, where the skills have not run OnAdded() yet anyway.
- GetSkill(Type, bool)
The character's own instance of a skill type (null when it is not learned). This is the prefab-free replacement for the old "same prefab address" comparison.
- GetSkill<T>(bool)
Looks a skill up by type. Skills are plain classes, so this is a straight type test over the character's own instances.
- StopUsingSkill(Skill)
Stops the skill that is running (blocked, hit, manual cancel) and cleans it up.