Skip to main content

EditableSlot

A class in Root.Township, Alta.Customization.

A spot on the customization mannequin for one group of slots. Grab it to pull the item off as a pickup, or drop a fitting pickup in its trigger to put it on. Client side.

Constructors​

MemberWhat it is
EditableSlot()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

7 private and internal fields
MemberWhat it is
private CustomizationWrapper activeWrapperCustomization wrapper being edited, or null when inactive.
private TriggerShape addTriggerTrigger where pickups are dropped to add them.
private HandIndex editableWithWhich hand may edit this slot. Default both.
private Dictionary<CustomizationPickup, int> hoveringPickups in the trigger and how many of their colliders are inside.
private static readonly Logger loggerNLog logger for this class.
private Interactable removerInteractable grabbed to take the item off.
private PlayerCustomizationSlotSet slotsSlot set this editable slot covers.

Methods​

MemberWhat it is
void Activate(CustomizationWrapper wrapper)Starts editing a customization wrapper: hooks the trigger and remover and enables the object.
void Deactivate()Stops editing: unhooks events, clears hovering pickups and disables the object.
protected uint Remove(Interactor interactor, out CustomizationArguments[] arguments)Removes the first item found in this slot's enabled slots, pushing history, and returns its hash (0 if none).
10 private and internal methods
MemberWhat it is
private bool Add(ControllerExtension interactor, ICustomizationDefinition item, CustomizationArguments[] arguments)Adds an item to the wrapper if the hand may edit and the item fits these slots.
private void AttemptPlace(Interactable interactable, Interactor interactor)When a hovering pickup is let go, tries to add a copy of its item and tells the pickup whether it worked.
private bool CanEdit(HandIndex hand)Whether a hand may edit: needs an active wrapper and a matching hand if editableWith isn't both.
private void Filter(Interactor interactor, Interactable interactable, ref bool result)Interaction filter on the remover; blocks the wrong hand and blocks grabbing when all its slots are disabled.
private bool Hover(ControllerExtension interactor, ICustomizationDefinition item)Whether a held item is one this slot would accept from that hand.
private async void InteractedWith(Interactable interactable, Interactor interactor)When the remover is grabbed, removes the slot's item and swaps the hand to a new pickup of it.
private bool IsApplicable(ICustomizationDefinition item)Whether any part of the item uses one of this slot's slots.
private void OnValidate()Editor: fills addTrigger from the same object if empty.
private void TriggerEntered(Collider collider)Starts tracking a held customization pickup that enters and fits, so dropping it places it.
private void TriggerExited(Collider collider)Stops tracking a pickup once all its colliders have left.