Exemplo n.º 1
0
        public void Dispose()
        {
            try
            {
                RenderFactory.RemoveRenderObject(this);
                AssetBundleManager.UnloadAssetBundle(name);
                if (children != null)
                {
                    for (var n = children.next; n != children;)
                    {
                        var           next  = n.next;
                        IRenderObject child = (IRenderObject)n;
                        if (child != null)
                        {
                            child.Parent = null;
                        }
                        n = next;
                    }
                    children = null;
                }

                if (components != null)
                {
                    if (dict == null)
                    {
                        dict = new Dictionary <IRenderComponent, bool>();
                    }
                    dict.Clear();

                    for (int i = 0; i < tempComponents.Count; i++)
                    {
                        var c = tempComponents[i];
                        if (c == null)
                        {
                            continue;
                        }
                        if (dict.ContainsKey(c))
                        {
                            continue;
                        }
                        dict[c] = true;
                        c.Destroy();
                    }
                    tempComponents.Clear();

                    components.Clear();
                    components = null;
                }

                if (timer != null)
                {
                    timer.Clear();
                }

                this.Parent = null;
                this.OnDestroy();
            }
            catch (Exception e)
            {
                LOG.LogError(e.ToString(), this.gameObject);
            }
        }
Exemplo n.º 2
0
 public override void Initialize()
 {
     instance = this;
 }