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.
- Listed in Global namespace: P
- Inherits or implements
NetworkEntityBehaviour,IProfessionSkillTester
Constructors
| Member | What it is |
|---|---|
PowerStrikeTester() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
13 private and internal fields
| Member | What it is |
|---|---|
private GameObject countVisualPrefab | Marker prefab. |
private MeshRenderer[] countVisuals | Marker renderers. |
private int currentCount | Strikes made so far. |
private Material dimMaterial | Material for markers not yet reached. |
private Material litMaterial | Material for markers reached. |
private Player player | Player being tested. |
private Material readyMaterial | Material for all markers once the count is reached. |
private ProfessionSkill skill | The skill being tested. |
private float spawnWidth | Width of the marker row. |
private MethodSync syncCount | Sync for the current count. |
private MethodSync syncStart | Sync for the needed count. |
private int targetCount | Strikes needed. |
private Transform visualsFolder | Parent of the markers. |
Methods
| Member | What 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
| Member | What 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. |