PlayerComponentController
A class in Root.Township, Alta.Networking.
Turns lists of components on or off for a player entity: server-only, client-only, and local player versus remote player. Starts every player as remote until it becomes the local player.
- Listed in Networking and servers
- Inherits or implements
MonoBehaviour,IInitializeAsLocalPlayer - Attributes
RequireComponent
Constructors
| Member | What it is |
|---|---|
PlayerComponentController() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
Methods
4 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Hooks up to the entity's InitializationFinished event. |
private void IInitializeAsLocalPlayer.InitializeAsLocalPlayer(PlayerController player) | Turns on the local behaviours and turns off the remote ones. |
private void SetBehavioursEnabled(NetworkEntity entity) | After init, sets server and client behaviours by side (skipped in local test), then turns local off and remote on. |
private void SetComponentsEnabled(IEnumerable<Behaviour> components, bool isEnabled) | Sets enabled on each component in the list. |