Skip to main content

PersonalSpace

A class in Root.Township, Alta.Character.

Sphere trigger that follows a player's feet to mark their personal space. Pointer checks the personal space layer when aiming, and it is turned off when the player dies.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private Transform cachedTransformCached transform of this object.
private PlayerController characterBacking field for Character.
private SphereCollider sphereColliderThe personal space sphere.

Properties​

MemberWhat it is
PlayerController Character { get; }The player this space belongs to.
float Radius { get; private set; }Effective radius, counting the sphere's downward offset.

Methods​

MemberWhat it is
void DisablePersonalSpace()Turns off the sphere and this component. Used when the player dies.
4 private and internal methods
MemberWhat it is
private void Awake()Works out Radius from the sphere and how far below the object it sits, and disables itself if there is no player.
private void LateUpdate()Moves the sphere to the player's feet.
private void OnDisable()Turns off the sphere collider.
private void OnEnable()Turns on the sphere collider.