Skip to main content

CosmeticPresetSlot

A class in Root.Township, Alta.Customization.

Client: one shelf slot in the customization room that holds a saved cosmetic preset trophy. Putting a trophy in saves it to the player's account presets; taking it out deletes it.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private GameObject effectParentGameObject holding the highlight effects.
private AltaEvent gotTrophyEvent raised when a trophy is saved here.
private Coroutine hapticsThe running haptics coroutine, if any.
private float hapticStrengthStrength of the hover haptic pulse.
private Transform trophyPositionTransform marking where the trophy sits.
private CosmeticPresetTrophyTrigger trophySourceTrigger that detects trophies near the slot.

Properties​

MemberWhat it is
int Index { get; set; }The preset index this slot saves to, set by CosmeticPresetsManager.
Vector3 TargetPosition { get; }Where a trophy sits in this slot.
Quaternion TargetRotation { get; }Rotation a trophy takes in this slot.
CosmeticPresetTrophy Trophy { get; private set; }The trophy in this slot, or null.

Methods​

MemberWhat it is
void Clear()Destroys the trophy in this slot, without touching the saved preset.
async void DeregisterTrophy(CosmeticPresetTrophy trophy)Removes the trophy from this slot and deletes the preset at this index from the account.
void RegisterTrophy(CosmeticPresetTrophy trophy)Places a trophy into this slot if both are free, without saving it. Used when loading presets.
async void SaveTrophy(CosmeticPresetTrophy trophy)Runs when a trophy is released into the slot. Moves it here and saves its preset to the account.
6 private and internal methods
MemberWhat it is
private void Awake()Hooks the trophy trigger's release, enter and exit events.
private void DisableEffects(CosmeticPresetTrophy trophy)Hides the slot's highlight effects. The overload taking a trophy only does it once no trophies are in the trigger.
private void DisableEffects()Hides the slot's highlight effects. The overload taking a trophy only does it once no trophies are in the trigger.
private void EnableEffects(CosmeticPresetTrophy trophy)Shows the highlight effects and starts haptics while a trophy hovers over an empty slot.
private IEnumerator Haptics() (iterator)Coroutine that buzzes the hand holding a hovering trophy, while the slot is empty.
private void RegisterTrophyInternal(CosmeticPresetTrophy trophy)Snaps the trophy to the slot, makes it kinematic and links the two.

Used in​

Members of other types that take, return or hold a CosmeticPresetSlot: