Skip to main content

PowerStrikeTester

A class in Root.Township, the global namespace.

Network entity at a skill shrine test area that shows a row of lights counting a player's strikes towards a strike succession skill. The server sends the count; clients light the markers.

Constructors​

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

Fields​

13 private and internal fields
MemberWhat it is
private GameObject countVisualPrefabMarker prefab.
private MeshRenderer[] countVisualsMarker renderers.
private int currentCountStrikes made so far.
private Material dimMaterialMaterial for markers not yet reached.
private Material litMaterialMaterial for markers reached.
private Player playerPlayer being tested.
private Material readyMaterialMaterial for all markers once the count is reached.
private ProfessionSkill skillThe skill being tested.
private float spawnWidthWidth of the marker row.
private MethodSync syncCountSync for the current count.
private MethodSync syncStartSync for the needed count.
private int targetCountStrikes needed.
private Transform visualsFolderParent of the markers.

Methods​

MemberWhat it is
override void Initialize()Sets up the start and count sync messages.
void InitializeForPlayer(ProfessionSkill skill, Player player)Server: for a strike succession skill, stores the player, reads the needed strike count, sends it and listens for count changes.
override void OnConnected(Player player)Server: sends the needed count to a joining player.
8 private and internal methods
MemberWhat it is
private void InitializeVisuals()Client: makes or trims the marker objects to match the needed count and lays them out.
private void OnDestroy()Stops listening for strike count changes.
private void OnDrawGizmosSelected()Draws the marker layout in the editor.
private void SyncCount(IPlayer player, Stream stream)Sends or reads the current strike count (0 to 7) and updates the markers.
private void SyncStart(IPlayer player, Stream stream)Sends or reads the needed strike count (0 to 7) and builds the markers on clients.
private void UpdateCount(Player player, ProfessionSkill skill, int strikeCount)Server: when the tracked player's count for the skill changes, sends it.
private void UpdateVisual()Lights one marker per strike, or shows all as ready once the count is reached.
private IEnumerable<Vector3> VisualPositions() (iterator)Spaces the markers evenly along spawnWidth.