Skip to main content

MicroTutorialFaceOrb

A class in Root.Township, ATT.MicroTutorial.

An action orb that starts a micro tutorial (entry orb) or leaves it (exit orb) when a player pulls it to their face and lets go. The client sends the activation and the server spawns or despawns the tutorial.

Constructors​

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

Fields​

11 private and internal fields
MemberWhat it is
private ActionOrb actionOrbThe action orb the player grabs.
private float distanceBeforeOrbIsForceReleasedHow far the holder can move from the origin before the orb is dropped.
private bool isForceReleaseEnabledWhether the orb is dropped when the holder walks away.
private static readonly Logger loggerClass logger.
private MicroTutorialSettings microTutorialSettingsThe tutorial an entry orb starts. Saved.
private IMicroTutorialSystem microTutorialSystemInjected micro tutorial system.
private Vector3 orbOriginPosition the orb returns to, set from its spawn position.
private MicroTutorialFaceOrbType orbTypeEntry or exit. Saved.
private MethodSync syncActivationMethod sync for the activation message.
private MethodSync syncOrbOriginMethod sync for the orb origin.
private MethodSync syncSettingsMethod sync for the orb type.

Methods​

MemberWhat it is
override void Initialize()Creates the method syncs for activation (SyncA), settings (SyncB) and orb origin (SyncC).
override void OnConnected(Player player)Sends the orb type to the joining player.
void SetTutorialSettings(MicroTutorialSettings newMicroTutorialSettings)Sets which tutorial the orb starts and makes it an entry orb. Used by MicroTutorialOrbInjector.
12 private and internal methods
MemberWhat it is
private void Activate()Client: sends the activation to the server when the orb is validly let go.
private async void ActivationSync(IPlayer player, Stream stream)Server, when reading: starts the tutorial for an entry orb or despawns it for an exit orb.
private void Awake()Hooks the pickup and let-go events and the entity's initialization and scene destruction.
private void Inject(IMicroTutorialSystem injectedMicroTutorialSystem)VContainer injection of the micro tutorial system.
private void MovedOutOfBounds(PlayerController player, Vector3 oldPosition, Vector3 newPosition, LocomotionFunction function)Client: force-drops the orb if the holder moves further than distanceBeforeOrbIsForceReleased from its origin.
private void OnDestroyByScene(NetworkEntity networkEntity, bool isUnload)Clears the entity's initialization listeners.
private void OnInteractionEnded(Interactable interactable, Interactor interactor)Stops watching the holder's position.
private void OnInteractionStarted(Interactable interactable, Interactor interactor)Client: starts watching the holder's position when force release is on.
private void ResetPosition(NetworkEntity networkEntity)Stores the orb's spawn position as its origin, sets it as the orb target and syncs it.
private async Task StartTutorial(IPlayer player)Spawns the configured tutorial for the player through the server controller, after null checks.
private void SyncOrbOrigin(IPlayer player, Stream stream)Method sync body for the orb origin.
private void SyncSettings(IPlayer player, Stream stream)Method sync body for the orb type. Skipped in local test.