ParticlesToPlayer
A class in Root.Township, Features.Visual_Effects.General_Scripts.
Plays a VfxData particle trail that flies from an origin to a given player. The VFX data is saved and sent to joining players; TriggerForPlayer plays it locally and does nothing on a headless server.
- Listed in ATT, Features and other game namespaces
- Inherits or implements
NetworkEntityBehaviour,ISavable<ParticlesToPlayerSaveData>,ISavableSave<ParticlesToPlayerSaveData>,ISavableSaveBase - Derived types
ParticlesToPlayerSaveData
Constructors
| Member | What it is |
|---|---|
ParticlesToPlayer() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|---|
private Transform origin | Where the particles start when not starting from the player. |
private MethodSync syncSetup | Method sync for the VFX data reference. |
private EntityMessageType uniqueMessageChannel | Message type used for the sync, default VfxData. Change it if another behaviour on the entity uses that channel. |
private bool usePlayerFeetAsOrigin | Start the particles at the player instead of origin. The code ends up placing them at the head. |
private VfxData vfxData | The effect to play. Saved. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Creates the setup sync on uniqueMessageChannel. |
void Load(ParticlesToPlayerSaveData data, ISerializeChildren childSerializer) | Restores the VFX data reference from save data. |
override void OnConnected(Player player) | Server: sends the VFX data reference to the joining player. |
ParticlesToPlayerSaveData Save(ISerializeChildren childSerializer) | Saves the VFX data reference. |
void TriggerForPlayer(Player player) | Not on headless: spawns the particles at origin (or at the player's head when usePlayerFeetAsOrigin is set) and moves them to the player. |