3 using System.Collections.Generic;
 
   12 [AddComponentMenu(
"Liberi/Despawn Behaviour")]
 
   36     public UJeli OffspringDetails;
 
   40         OffspringDetails = 
new UJeli();
 
   45         if (OffspringPrefab != null)
 
   49             foreach (var detailNode 
in InheritedDetailNodes)
 
   51                 if (!parentDetails.HasChild(detailNode))
 
   54                 OffspringDetails.AddChild(parentDetails[detailNode].Clone());
 
   60             if (OffspringPrefab != null)
 
   61                 Sync.
Spawn(OffspringPrefab, transform.position, transform.GetDirection(), 0, OffspringDetails);
 
   63         else if (Game.IsClient)
 
   65             if (OffspringPrefab != null && IsOffspringEffect)
 
   66                 Sync.
SpawnLocal(OffspringPrefab, transform.position, transform.GetDirection(), OffspringDetails);
 
   69                 SoundPool.Play(Sound, transform.position);
 
   76     private void CleanUpParticles ()
 
   78         foreach (ParticleSystem pSystem 
in GetComponentsInChildren<ParticleSystem>())
 
   80             if (pSystem.transform.parent != null)
 
   81                 pSystem.transform.parent = null;
 
   83             pSystem.enableEmission = 
false;
 
   86             if (pSystem.GetComponent<ParticleCleanup>() == null)
 
   87                 pSystem.gameObject.AddComponent<ParticleCleanup>();
 
bool IsOffspringEffect
Whether or not the spawned offspring object is just a client-side effect as opposed to a synchronized...
 
bool ParticleCleanup
Whether or not to detatch child particle systems, stop them, and let them finish simulating. 
 
static UJeli GetSpawnDetails(GameObject go)
Gets the spawn details of a given object. 
 
static GameObject Spawn(string prefabId, Vector3 position, int ownerPeerIndex=0, UJeli details=null)
Spawn an object onto the network. 
 
Controls an object's behaviour on despawning. 
 
AudioClip Sound
A sound effect to play on despawn. 
 
GameObject OffspringPrefab
The prefab to spawn when this object despawns. 
 
Sound pool. Allows on-demand playing of 3D sounds, with sound properties based on prefab...
 
static GameObject SpawnLocal(string prefabId, Vector3 position, UJeli details=null)
Spawn an object locally without propagating onto the network. 
 
Unity version of Jeli markup class. 
 
string[] InheritedDetailNodes
An array of the names of all the nodes from this object's spawn details which should be inherited by ...
 
This class server two main functions: 1) As a MonoBehaviour, it allows for network synchronization of...