NetworkStarer
A class in Root.Township, the global namespace.
Makes a creature look at a target with its eyes, then its neck joints, and optionally turn its body. Staring and the target sync to clients.
- Listed in Global namespace: M to O
- Inherits or implements
NetworkEntityBehaviour - Nested types
ChangedDirection,ChangedState,RotatingJoint,RotatingStructure
Constructors
| Member | What it is |
|---|---|
NetworkStarer() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
NetworkStarer.ChangedState ChangedTurning | Called when body turning starts or stops. |
NetworkStarer.ChangedDirection ChangedTurningDirection | Called with the turn direction (1, -1, or 0 when stopped). |
11 private and internal fields
| Member | What it is |
|---|---|
private float bodyDotWhenRotating | Turning stops once the facing dot reaches this value. |
private bool isStaring | Backing field for IsStaring. |
private Transform leftEye | Left eye transform. |
private Quaternion leftEyeOriginalLocalTransform | Left eye's rest rotation. |
private float maxEyeAngle | Furthest an eye can turn from rest, in degrees. |
private NetworkStarer.RotatingStructure neck | Chain of neck joints, each with its own angle limit. |
private NetworkEntity networkTarget | Network entity of the target, used to sync it. |
private Transform rightEye | Right eye transform. |
private Quaternion rightEyeOriginalLocalTransform | Right eye's rest rotation. |
private MethodSync syncSerialize | Method sync for the staring state. |
private Transform target | Backing field for Target. |
Properties
Methods
| Member | What it is |
|---|---|
override void Initialize() | Creates the sync message. |
4 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Stores the eyes' rest rotations and sets up the neck. |
private void LateUpdate() | Runs Stare while staring at a target. |
private void Stare() | Points the eye on the target's side at it, bending the neck when the eye can't reach and turning the body when the neck can't. |
private void Sync(IPlayer player, Stream stream) | Reads or writes the staring flag and target entity ID; a client stops staring if the target is missing. |