Exemplo n.º 1
0
        public void Render(DwarfTime time, SpriteBatch batch, Vector2 globalOffset)
        {
            GlobalOffset = globalOffset;


            RootComponent.LocalBounds = new Rectangle((int)globalOffset.X, (int)globalOffset.Y, 0, 0);
            RootComponent.UpdateTransformsRecursive();
            RootComponent.Render(time, batch);

            if (FocusComponent != null)
            {
                FocusComponent.Render(time, batch);
            }


            foreach (GUIComponent component in DrawAfter)
            {
                component.Render(time, batch);
            }


            DrawAfter.Clear();

            if (DebugDraw)
            {
                RootComponent.DebugRender(time, batch);
            }
        }
Exemplo n.º 2
0
        public void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera)
        {
            if (RootComponent != null)
            {
                RootComponent.UpdateTransformsRecursive();
            }

            Factions.Update(gameTime);


            foreach (GameComponent component in Components.Values)
            {
                if (component.IsActive)
                {
                    component.Update(gameTime, chunks, camera);
                }

                if (component.IsDead)
                {
                    Removals.Add(component);
                    component.IsActive  = false;
                    component.IsDead    = true;
                    component.IsVisible = false;
                }
            }


            HandleAddRemoves();
        }
Exemplo n.º 3
0
        public void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera)
        {
            GamePerformance.Instance.StartTrackPerformance("Update Transforms");
            if (RootComponent != null)
            {
                RootComponent.UpdateTransformsRecursive(null);
            }
            GamePerformance.Instance.StopTrackPerformance("Update Transforms");

            GamePerformance.Instance.StartTrackPerformance("Factions");
            Factions.Update(gameTime);
            GamePerformance.Instance.StopTrackPerformance("Factions");

            GamePerformance.Instance.TrackValueType("Component Count", Components.Count);
            GamePerformance.Instance.TrackValueType("Updateable Count", UpdateableComponents.Count);
            GamePerformance.Instance.TrackValueType("Renderable Count", RenderableComponents.Count);

            GamePerformance.Instance.StartTrackPerformance("Update Components");
            foreach (var componentType in UpdateableComponents)
            {
                foreach (var component in componentType.Value)
                {
                    //component.Manager = this;

                    if (component.IsActive)
                    {
                        //GamePerformance.Instance.StartTrackPerformance("Component Update " + component.GetType().Name);
                        component.Update(gameTime, chunks, camera);
                        //GamePerformance.Instance.StopTrackPerformance("Component Update " + component.GetType().Name);
                    }
                }
            }

            GamePerformance.Instance.StopTrackPerformance("Update Components");

            HandleAddRemoves();
        }