JointSlotGroup
A class in Root.Township, Alta.Crafting.
Groups several joint slots so only a set number of them (default 1) can be used at once. It counts as used when any child slot is.
- Listed in Crafting and making
- Inherits or implements
MonoBehaviour,IJointSlotComponent
Constructors
| Member | What it is |
|---|---|
JointSlotGroup() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
Properties
| Member | What it is |
|---|---|
bool HasSpace { get; } | True while fewer children are used than the maximum. |
bool IsUsed { get; } | True if any child slot is used. |
HashSet<IJointSlotComponent> Used { get; } | The child slots currently in use. |
1 private and internal property
Events
| Member | What it is |
|---|---|
event IsJointAvailable isAvailable | Raised to ask whether the group is available; children route their checks through it. |
event Action<IJointSlotComponent> UsedChanged | Raised when the set of used children changes. |
Methods
6 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Hooks the child slots in targets and raises UsedChanged if any start used. |
private void ChildChanged(IJointSlotComponent child) | Adds or removes a child from Used when its used state changes, and raises UsedChanged. |
private void IsAvailable(ref bool isAvailable) | Availability check for each child: asks this group's own listeners while unused, then requires space. |
private void OnValidate() | Editor: renames the object to show the group's maximum. |
private void Process(MonoBehaviour[] targets) | Hooks each target that is a joint slot component (or has one) into this group. |
private void Process(Transform[] targets) | Hooks each target that is a joint slot component (or has one) into this group. |