PlayerCharacter
A class in Root.Township, Alta.Character.
The player's body in the world: the PlayerController used for normal play, with the character dummy, IK, belt and back docks, inventory and customization. Both sides; get it from player.PlayerCharacter.
- Listed in Players and characters
- Inherits or implements
SmoothLocomotionPlayerController,IHasFingertips - Attributes
SelectionBase - Documented in PlayerController and the body
Constructors
| Member | What it is |
|---|---|
PlayerCharacter() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
24 private and internal fields
| Member | What it is |
|---|---|
private PickupDockGroup backDocks | Backing field for BackDocks. |
private PickupDockGroup beltDocks | Backing field for BeltDocks. |
private ColliderGroup bodyColliderGroup | Backing field for BodyColliderGroup. |
private BodyController bodyController | Backing field for BodyController. |
private Coroutine currentRotate | Coroutine field for a rotation. Not used in this class. |
private Coroutine currentScaling | Coroutine field for scaling. Not used in this class. |
private Coroutine currentTranslate | Coroutine field for a move. Not used in this class. |
private PlayerCustomizationHandler customizationHandler | Backing field for CustomizationHandler. Destroyed when the character is unlinked or destroyed. |
private DockPositionController dockPositionController | Backing field for DockPositionController. |
private CharacterDummyPointer dummy | Points to the CharacterDummy (rig, animator, cosmetics) behind Dummy. |
private Transform headFollow | Backing field for HeadFollow. |
private CharacterIKController ikController | Backing field for IKController. |
private bool isFadingOnMove | Serialized flag. Not read in this class. |
private CharacterLocalityController localityController | Backing field for LocalityController, which also supplies Head. |
private float minimumDistanceForTrail | Serialized distance for the teleport trail (5 by default). Not read in this class. |
private float moveDuration | Backing field for MoveDuration. |
private Renderer nonBakedCharacterRenderer | Editor-only renderer that Bake destroys at build time. |
private Transform nonBakedCharacterRendererPivot | Pivot for the non-baked renderer. Not used in this class. |
private RigidbodyCollection rigidbodies | Backing field for Rigidbodies. |
private float scaleVelocity | Smoothing velocity for scaling. Not used in this class. |
private PlayerSpecialEffectsController specialEffectsController | Backing field for SpecialEffectsController. |
private PooledObjectDefinition teleporterTrail | Pooled teleport trail effect. Not used in this class. |
private LocomotionStyle teleportStyle | Backing field for TeleportStyle. |
private Vector3 translateVelocity | Smoothing velocity for moving. Not used in this class. |
Properties
| Member | What it is |
|---|---|
PickupDockGroup BackDocks { get; } | The dock group on the player's back. |
PickupDockGroup BeltDocks { get; } | The dock group on the player's belt. |
Animator BodyAnimator { get; private set; } | The character dummy's animator. Turned off during physics steps while IK runs. |
ColliderGroup BodyColliderGroup { get; } | The body's colliders. Downed and dead states switch them off; arrows ignore the shooter's own. |
override BodyController BodyController { get; } | The body controller that moves the body under the head and hands. |
PlayerCustomizationHandler CustomizationHandler { get; } | Applies the player's cosmetics to this body. Attached when the body links to a player. |
DockPositionController DockPositionController { get; } | Places belt docks to fit the body type. |
CharacterDummy Dummy { get; } | The character dummy (model, animator, fingertips, cosmetics packer). |
override Transform Head { get; } | The head transform from the locality controller. |
override Transform HeadFollow { get; } | Transform that follows the head. |
override float HeadHeight { get; } | Local height of the head, from the locality controller. |
PlayerHealth Health { get; } | The body's PlayerHealth. |
CharacterIKController IKController { get; } | The IK controller, updated every frame and physics step. |
Inventory Inventory { get; private set; } | The player's inventory helper, created in Awake. |
CharacterLocalityController LocalityController { get; } | Handles which parts show for the local player versus others (head and so on). |
PlayerLocomotionController LocomotionController { get; } | The PlayerLocomotionController moving this body. |
float MoveDuration { get; } | Serialized move duration (0.01 seconds by default); nothing else in this build reads it. |
RigidbodyCollection Rigidbodies { get; } | The body's rigidbodies. |
PlayerSpecialEffectsController SpecialEffectsController { get; } | Plays special effects on the body. |
LocomotionStyle TeleportStyle { get; set; } | Locomotion style for teleports. Settable; nothing else in this build reads it. |
protected override SaveMode SaveMode { get; } | Always SaveMode.Player: saved with the player save, not with a chunk. |
1 private and internal property
| Member | What it is |
|---|---|
private FingerTipSettings IHasFingertips.FingerTips { get; } | Fingertip settings, taken from the character dummy. |
Events
| Member | What it is |
|---|---|
event ScaleChangedHandler ScaleChanged | Declared for scale changes and listened to by the dock dropper, but nothing in this build raises it. |
Methods
| Member | What it is |
|---|---|
override void Bake(bool isSaving) | Build time: removes the non-baked character renderer. |
override void LoadFrom(PlayerSave save) | Server: loads the body and hands from the player save. A player with no saved prefab data gets the default starting data. |
override void OnConnected(Player player) | When the owning player connects, sends them their last safe position if one is saved. |
override void SaveTo(PlayerSave save) | Writes the body's network prefab data (docks, held items and so on) into the player save. |
override void UnlinkFromPlayer() | Destroys the customization handler and stops listening for armed changes before the base unlink. |
protected override void Awake() | Sets up health, creates the Inventory, grabs the body animator and hooks dock placement to the body type once cosmetics are packed. |
protected override void OnDestroy() | Destroys the customization handler with the body. |
6 private and internal methods
Used in
Members of other types that take, return or hold a PlayerCharacter:
PlayerEffectController.player, PlayerEffectController.Player, Inventory.Inventory, PlayerText.player, Inventory.AddBackDocks, Inventory.AddBeltDocks, EquipmentCustomizationRoom.linkedPlayerCharacter, Chest.currentPlayer, IPlayer.PlayerCharacter, CombatShellAnimator.CombatShellAnimator, ShellAnimator.Character, ShellAnimator.ShellAnimator, StatEffectShellAnimator.StatEffectShellAnimator, PlayerStateBase.PlayerCharacter, LocalPlayerHeadRenderer.character, LocalPlayerHeadRenderer.Register, PlayerSwapMaterialFilter.playerMap, PlayerSwapMaterialFilter.toRemove, PlayerSwapMaterialFilter.PlayerOriginalMaterials.PlayerOriginalMaterials, EventOrb.playerCharacter, DownedStateDebuffManager.ApplyDebuffToPlayer, DownedStateDebuffManager.playerStatModifiers, DownedStateDebuffManager.RemoveDebuffsForPlayer, PlayerControllerPrefabs.vrPlayer, PlayerControllerPrefabs.VrPlayer, BowString.IgnoreCollisionBetweenArrowAndBow, BowString.PlayerAndBowColliders, CharacterIKController.playerCharacter, ClothManager.player, ClothManager.Player, Embeddable.IsRaycastedRigidbodyFromTheThrowingPlayer, ExtraArrowUpdater.interactingPlayer, GravityChanger.playerCharacter, GravityChanger.PlayerCharacter, Player.PlayerCharacter, PlayerDockDropper.player, PlayerEventsManager.character, PlayerEventsManager.OnCharacterAdded, PlayerLocomotionController.PlayerController, PlayerProgressionManager.RegisterStat, PlayerSpecialEffectsController.playerCharacter, ProgressionSettings.LevelUpEffect, RigidbodyGroup.player, RigidbodyGroup.Player, SkillOrbInteractionSpline.character, SpiritModeShellAnimator.SpiritModeShellAnimator, SplineParticlesPooled.character, TelescopicPickup.character, ReviveCompletableActivity.playerCharacter, ReviveCompletableActivity.ReviveCompletableActivity.