예제 #1
0
        internal static void AddComp(EngineComponent comp)
        {
            EngineComponent c = (from com in comps
                                 where com.ID == comp.ID
                                 select com).FirstOrDefault();

            if (c == null)
            {
                if (initialized)
                {
                    comp._Init();
                }

                comps.Add(comp);

                if (comp is IRenderComponent)
                {
                    renderComps.Add(comp as IRenderComponent);
                }

                if (comp is IUpdate)
                {
                    updateComps.Add(comp as IUpdate);
                }

                if (comp is IDispose)
                {
                    disposableComps.Add(comp as IDispose);
                }
            }
        }
        internal static void AddComp(EngineComponent comp)
        {
            EngineComponent c = (from com in comps
                                 where com.ID == comp.ID
                                 select com).FirstOrDefault();

            if (c == null)
            {
                comps.Add(comp);

                if (comp is IPostGameDraw)
                {
                    postGame.Add(comp as IPostGameDraw);
                }

                if (comp is IRenderComponent)
                {
                    renderComps.Add(comp as IRenderComponent);

                    List <IRenderComponent> temp;
                    SortHelper.SortList <IRenderComponent>(ref renderComps, out temp);

                    renderComps = temp;
                }

                if (comp is IPostRenderComponent)
                {
                    postRenderComps.Add(comp as IPostRenderComponent);

                    List <IPostRenderComponent> temp;
                    SortHelper.SortList <IPostRenderComponent>(ref postRenderComps, out temp);

                    postRenderComps = temp;
                }

                if (comp is IUpdate)
                {
                    updateComps.Add(comp as IUpdate);
                }

                if (comp is IDispose)
                {
                    disposableComps.Add(comp as IDispose);
                }

                if (initialized)
                {
                    comp._Init();
                }
            }
        }