Skip to main content

FlyCamHands

A class in Root.Township, the global namespace.

Controller extension on the fly cam's hands: sparks or explosions, invisibility toggle and mic mute shortcuts. Actions are synced so other players see them.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private PooledObjectDefinition damageDefinitionPooled object spawned for the explosion hit; its FixedImpactor is charged.
private FlyCamPlayer flyCamThe owning FlyCamPlayer.
private FlyCamInput flyCamInputFly cam input actions, read for the explosion modifier.
private MODSMicMuteQuickAccessAction modMuteActionQuick access action used for the mod mic mute.
private PooledObjectDefinition sparkDefinitionPooled FlintSpark spawned by the spark action.
private MethodSyncStruct<FlyCamHands.Controls> syncInputMethod sync for the spark, invisibility and hit actions.

Methods​

MemberWhat it is
override void InitializeControllerExtension()Sets up the input sync message (SyncE).
override void OnConnectedToPlayer(Player player)Sends the current visibility to a joining player.
protected override void Awake()Hooks the debug spark, debug invisibility, mute and mod mute actions and enables the fly cam input map.
7 private and internal methods
MemberWhat it is
private void InvisibilityPressed(PlayerInput controller)Toggles whether the fly cam's name shows (its visibility), shows a message and syncs it.
private bool IsTriggeringExplosionInsteadOfSparks()True when grab is held or the explosion modifier input is pressed.
private void ModMuteMic(PlayerInput playerInput)Runs the mod mic mute quick action from the left controller.
private void MuteOwnMic(PlayerInput playerInput)Toggles the local Vivox mic mute and shows the new state.
private void ReceiveControls(IPlayer player, Stream stream, FlyCamHands.Controls input)Sync handler: on read replays a spark, visibility change or hit, and the server relays it. Rejects messages from other players.
private void Spark()On the owner or server, spawns a forced flint spark; the server also simulates sparks so fires can light.
private void SparkPressed(PlayerInput controller)Spawns a damaging FixedImpactor in front if the explosion modifier is held, else sparks, then syncs which.