Beispiel #1
0
 public LogicSystemManager()
 {
     if (LogicSystemManager.aBQ != null)
     {
         Log.Fatal("LogicSystemManager already created");
     }
     LogicSystemManager.aBQ = this;
 }
Beispiel #2
0
        protected virtual void OnDestroy()
        {
            if (editor_excludeEntityFromWorld)
            {
                return;
            }

            if (extendedProperties != null && !Editor_IsExcludedFromWorld())
            {
                DestroyExtendedProperties();
            }

            if (Name != "" && IsPostCreated)
            {
                Entity entity = Entities.Instance.entitySetByName[Name];
                if (entity == this)
                {
                    Entities.Instance.entitySetByName.Remove(Name);
                }
            }

            if (LogicSystemManager.Instance != null && LogicSystemManager.Instance.Parent == this)
            {
                LogicSystemManager logicSystemManager = null;
                foreach (Entity current in Children)
                {
                    if (!current.isDestroyed)
                    {
                        if (logicSystemManager == null && current == LogicSystemManager.Instance)
                        {
                            logicSystemManager = (LogicSystemManager)current;
                        }
                        else
                        {
                            current.executeDestory();
                        }
                    }
                }
                if (logicSystemManager != null)
                {
                    logicSystemManager.executeDestory();
                }
            }
IL_F5:
            while (subscriptionsToDeletionEvent != null && subscriptionsToDeletionEvent.Count != 0)
            {
                for (int i = 0; i < subscriptionsToDeletionEvent.Count; i++)
                {
                    int count = subscriptionsToDeletionEvent.Count;
                    if (subscriptionsToDeletionEvent[i] != null)
                    {
                        subscriptionsToDeletionEvent[i].DeleteSubscribedToDeletion(this);
                    }

                    if (count != subscriptionsToDeletionEvent.Count)
                    {
                        goto IL_F5;
                    }
                }
                while (subscriptionsToDeletionEvent.Count != 0)
                {
                    if (subscriptionsToDeletionEvent[0] == null)
                    {
                        subscriptionsToDeletionEvent.RemoveAt(0);
                    }
                    else
                    {
                        UnsubscribeToDeletionEvent(subscriptionsToDeletionEvent[0]);
                    }
                }
                break;
            }
            this.c();
            isDestroyed = true;
        }
Beispiel #3
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     LogicSystemManager.aBQ = null;
 }