Ejemplo n.º 1
0
 // 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));
 }
Ejemplo n.º 2
0
 /*! @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();
 }
Ejemplo n.º 3
0
    /// <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;
        }
    }
Ejemplo n.º 4
0
 /// <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);
 }