PlayerDetect
A class in Root.Township, the global namespace.
Server: detects players whose feet are inside a sphere or box around this object and fires events as they enter and leave. Its shape is saved with the object.
- Listed in Global namespace: P
- Inherits or implements
NetworkEntityBehaviour,ISavable<PlayerDetectSaveData>,ISavableSave<PlayerDetectSaveData>,ISavableSaveBase - Derived types
PlayerDetectSaveData
Constructors
| Member | What it is |
|---|---|
PlayerDetect() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
9 private and internal fields
| Member | What it is |
|---|---|
private Vector3 boundSize | Size of the local space box, when isUsingBounds is on. |
private UnityEvent firstEntered | Unity event fired when the first player enters an empty area. |
private HashSet<Player> inArea | Backing set for InArea. |
private bool isUsingBounds | If true, uses a box of boundSize instead of a sphere. |
private UnityEvent lastLeft | Unity event fired when the last player leaves. |
private PlayerUnityEvent playerEntered | Unity event behind PlayerEntered. |
private bool playerInAreaDebug | Inspector flag showing if any player is in the area. |
private PlayerUnityEvent playerLeft | Unity event behind PlayerLeft. |
private float radiusSquared | The sphere's radius, stored squared. |
Properties
| Member | What it is |
|---|---|
IReadOnlyCollection<IPlayer> InArea { get; } | The players inside the area right now. |
Events
| Member | What it is |
|---|---|
event UnityAction<IPlayer> PlayerEntered | Fires with the player when one enters the area. |
event UnityAction<IPlayer> PlayerLeft | Fires with the player when one leaves the area. |
Methods
3 private and internal methods
Used in
Members of other types that take, return or hold a PlayerDetect: