Class to create visible hierarchies and emitter pooling within Magical Box
Though any GameObject can be used to group emitters (as long as it's inside a ParticleSystem's child hierarchy), Anchors are shown in the editor window and draw their own gizmo icon. They also include pooling manager capabilities for easy emitter pooling
Inheritance: MBObject
示例#1
0
    /// <summary>
    /// Creates a clone of an existing anchor and adds it as a child of source
    /// </summary>
    /// <param name="source">the anchor to be cloned</param>
    /// <param name="parent">the new parent of the clone</param>
    /// <returns>the new anchor</returns>
    public MBAnchor AddAnchor(MBAnchor source, MBObject parent)
    {
        if (!parent.Matches(typeof(MBParticleSystem), typeof(MBEmitter), typeof(MBAnchor)))
            return null;
        if (parent is MBEmitter && ((MBEmitter)parent).IsTrail) return null;

        if (source) {
            MBAnchor anc = (MBAnchor)Object.Instantiate(source);
            // initialize hierarchy
            anc.SetParent(parent);
            anc.mbReloadHierarchy();
            anc.Transform.position = parent.Transform.position;
            return anc;
        }
        else
            return null;
    }
示例#2
0
 // Use this for initialization
 void Awake()
 {
     if (!Pool)
         Pool = GetComponent<MBAnchor>();
 }