// Use this for initialization void Start() { if (txtKeys.Length==0) txtKeys= "\"WASD/Cursors\": Move \"Fire2\": Turn \"Space\": Reset \"F4\":Toggle Fullscreen"; orgPos = transform.position; orgRot = transform.rotation; if (!ParticleSystem) ParticleSystem = (MBParticleSystem)FindObjectOfType(typeof(MBParticleSystem)); }
/*! @name Internal Public * Don't use them unless you know what you're doing */ //@{ /// <summary> /// Force this object and all child objects to refetch parent and reload/recache their stuff /// </summary> /// <remarks>This is used to update the cached hierarchy after changes were made</remarks> public virtual void mbReloadHierarchy() { mParticleSystem = null; mParent = null; mChildren = null; // cache/refetch now if (ParticleSystem) { } if (Parent) { } // Reload children foreach (MBObject obj in Children) obj.mbReloadHierarchy(); }
/// <summary> /// Sets a new parent for this object /// </summary> public virtual void SetParent(MBObject parent) { // Valid target? if ((parent is MBParameter) || (this is MBParameter && !(parent is MBEmitter))) { Debug.LogError(string.Format("Magical Box: '{0}' ({1}) can't be a child of '{2}' ({3}) !", name, GetType(), parent.name, parent.GetType())); return; } mTransform = null; if (mParent) mParent.Children.Remove(this); mParent = parent; if (parent) { transform.parent = parent.Transform; mParent.Children.Add(this); mParticleSystem = parent.ParticleSystem; } }
/// <summary> /// Saves TextureAtlas of a particle system to file /// </summary> public static void SaveTextureAtlas(MBParticleSystem sys) { string path=EditorUtility.SaveFilePanelInProject("Save texture atlas", sys.name + "_atlas.png", "png", "Save the current texture atlas at..."); MBUtility.SaveTexture(sys.TextureAtlas, path); }