ActionItem
A class in Root.Township, the global namespace.
Base for an item that belongs to one player and fades in and out with a materialize effect (the friend request token, the gymnasium teleport tablet). The server sets the owner and syncs it.
- Listed in Global namespace: A to B
- Inherits or implements
NetworkEntityBehaviour - Derived types
GymnasiumTeleportTablet,FriendRequestToken,SocialTablet
Constructors
| Member | What it is |
|---|---|
ActionItem() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private float fadeDuration | Seconds a fade takes. On fade out the server destroys the entity after this long. |
private static Logger logger | Class logger, used for owner updates. |
private RendererMaterializer materializer | Backing field for Materializer, which runs the materialize and dematerialize effect. |
private int owner | Backing field for Owner, the owning player's id. |
private RendererGroup renderersToMaterialize | Backing field for RenderersToMaterialize. |
private MethodSyncStruct<bool> syncEffect | Method sync for fade requests, sent by the server to chunks. |
private MethodSync syncOwner | Method sync for the owner, sent to chunks on setup and to each player that connects. |
Properties
| Member | What it is |
|---|---|
bool IsLocalPlayer { get; private set; } | True if the owner is the local player. |
RendererMaterializer Materializer { get; } | The materializer that plays the fade. |
int Owner { get; } | User id of the owning player. |
RendererGroup RenderersToMaterialize { get; } | The renderers the fade applies to. |
protected bool HasReceivedOwnerMessage { get; private set; } | True once a client has been told the owner. |
Events
| Member | What it is |
|---|---|
event Action<IPlayer> OwnerUpdated | Raised when the owner is set or received. |
Methods
| Member | What it is |
|---|---|
virtual void Fade(bool isFadingIn) | Fades in or out. Server: syncs it, and destroys the entity after fading out. |
override void Initialize() | Sets up the owner and fade messages and the materializer targets. |
override void OnConnected(Player player) | Server: sends the owner to a joining player. |
virtual void SetupOwner(IPlayer player) | Sets the owner and syncs it to the chunk. |
protected virtual void FinishFadeIn() | Hook called when fading in finishes. Empty in the base class. |
protected virtual void StartFade(bool isFadingIn) | Hook called when a fade starts. Empty in the base class. |
2 private and internal methods
| Member | What it is |
|---|---|
private void SyncEffect(IPlayer player, Stream stream, bool isFadingIn) | Syncs a fade in or out. Clients that receive it run Fade locally. |
private void SyncOwner(IPlayer player, Stream stream) | Syncs the owner's player id. A remote client then sets IsLocalPlayer, marks the message received and raises OwnerUpdated. |
Used in
Members of other types that take, return or hold a ActionItem: