Example #1
0
    public static void Update()
    {
        if (!bInit)
        {
            return;
        }

        InvalidList.Clear();

        U3D_Render.EntityView view;
        foreach (TopName var in m_TopNameMap.Values)
        {
            TopName tn = var;
            view = EntityFactory.getEntityViewByID(tn.ID);

            if (view == null)
            {
                InvalidList.Enqueue(tn);
                continue;
            }

            if (!tn.Entry)//实体被删除
            {
                InvalidList.Enqueue(tn);
                continue;
            }

            if (!tn.Entry.activeSelf || !view.StateMachine.GetVisible())//实体没有被激活或者不可见
            {
                if (tn.GetEnable())
                {
                    tn.SetEnable(false);
                }
            }
            else//正常的实体
            {
                if (!tn.GetEnable())
                {
                    tn.SetEnable(true);
                }
                tn.OnUpdate();
            }
        }

        while (InvalidList.Count > 0)
        {
            //移除无效的TopName节点
            TopName b = InvalidList.Dequeue();
            if (OptimitzedControlPlane.Instance.EnityCreateOptimize)
            {
                CacheTopName(b);
            }
            else
            {
                TopNameManager.Destroy(b);
            }
        }

        InvalidList.Clear();
    }
Example #2
0
    /// <summary>
    /// 一般更新
    /// </summary>
    private static void NormalUpdate()
    {
        InvalidList.Clear();
        if (null != m_BloodMap)
        {
            foreach (GfxBlood var in m_BloodMap.Values)
            {
                GfxBlood gba = var;
                U3D_Render.EntityView view = EntityFactory.getEntityViewByID(gba.ID);
                if (view == null)
                {
                    InvalidList.Enqueue(gba);
                    continue;
                }
                if (!gba.Entry)
                {
                    InvalidList.Enqueue(gba);
                    continue;
                }

                if (!gba.Entry.activeSelf || !view.StateMachine.GetVisible())//实体没有被激活或者不可见
                {
                    if (gba.GetEnable())
                    {
                        gba.SetEnable(false);
                    }
                }
                else//正常的实体
                {
                    if (!gba.GetEnable())
                    {
                        gba.SetEnable(true);
                    }
                    gba.OnUpdate();
                }
            }
        }


        while (InvalidList.Count > 0)
        {
            //移除无效的Blood节点
            GfxBlood b = InvalidList.Dequeue();
            if (OptimitzedControlPlane.Instance.EnityCreateOptimize)
            {
                CacheBlood(b);
            }
            else
            {
                GfxBloodManager.Destroy(b);
            }
        }
        InvalidList.Clear();
    }