Skip to main content

EquipmentCustomizationRoom

A class in Root.Township, Alta.Customization.

Client: the room spawned for a player's equipment (dress-up) mode, with a dummy that shows their customization and copies their pose. EquipmentState links and unlinks it.

Constructors​

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

Fields​

11 private and internal fields
MemberWhat it is
private Transform bodyTransformBody transform of the dummy, passed to the rig poser.
private Transform boundaryTransformThe room boundary. Its x scale times two is the distance the player can walk away.
private TransformDeltaChangeChecker changeCheckerWatches the player's head and controllers and fires when all of them have stayed still long enough.
private PlayerCustomizationHandler customizationHandlerCustomization handler for the dummy, attached to the player's customization.
private CharacterDummyPointer dummyPointerPoints to the character dummy used in the room.
private BoneIdentifier headWhich bone of the dummy rig is the head.
private PlayerCharacter linkedPlayerCharacterThe linked player's PlayerCharacter. Pose copying is only set up when the controller is one.
private AltaCoroutine playerLeftBoundaryCheckerRunning CheckIfOutsideBoundary coroutine.
private AltaCoroutine poseCheckingDelayRunning DelayPoseChecking coroutine.
private CharacterRigPoser poserCopies the player character's pose onto the dummy rig.
private EquipmentRoomAnimator roomAnimatorPlays the room's appear and disappear animations.

Properties​

MemberWhat it is
CharacterDummy Dummy { get; private set; }The character dummy in the room, set by LinkToPlayer.
Transform DummyHead { get; private set; }The dummy's head bone, used to aim the camera flash.
Player Player { get; private set; }The player the room is linked to.
1 private and internal property
MemberWhat it is
private EquipmentStateSettings Settings { get; set; }The equipment state settings, loaded in Awake.

Events​

MemberWhat it is
event Action PlayerLeftBoundaryRaised when the player has stayed outside the room boundary for too long.

Methods​

MemberWhat it is
void LinkToPlayer(Player player)Starts the room for a player: attaches their customization to the dummy, sets up pose copying and the boundary check, and plays the appear animation and sound.
void Unlink()Stops pose copying and the boundary check, destroys the customization handler and plays the disappear animation, which then destroys the room.
7 private and internal methods
MemberWhat it is
private void AttemptToCopyPose()When the player holds still, poses the dummy like them and, if set up, flashes the screen and plays the pose sound.
private void Awake()Loads the EquipmentStateSettings for the room.
private IEnumerator CheckIfOutsideBoundary() (iterator)Coroutine: while the player's feet are outside the boundary, ramps up controller haptics and raises PlayerLeftBoundary after the set time.
private IEnumerator DelayPoseChecking() (iterator)Coroutine: waits the settings' start delay, then starts watching the player's head and hands for a freeze.
private void DestroyRoom()Destroys the room object once its disappear animation ends.
private bool IsValidDummyBone(Transform bone)Bone filter for the poser: only bones whose names end in _jnt.
private void SetupPoseCopying()Creates the change checker on the player's head and controllers and the rig poser that copies their pose to the dummy.

Used in​

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