示例#1
0
        public void Update(DwarfTime time)
        {
            RoomBuilder.Faction = this;
            RoomBuilder.CheckRemovals();

            Minions.RemoveAll(m => m.IsDead);
            SelectedMinions.RemoveAll(m => m.IsDead);

            if (this == World.PlayerFaction)
            {
                foreach (var m in Minions.Where(c => !SelectedMinions.Contains(c)))
                {
                    if (m.Creature.SelectionCircle != null)
                    {
                        m.Creature.DeleteSelectionCircle();
                    }
                    m.Creature.Sprite.DrawSilhouette = false;
                }
                ;

                foreach (CreatureAI creature in SelectedMinions)
                {
                    if (creature.Creature.SelectionCircle == null)
                    {
                        creature.Creature.Physics.AddChild(new SelectionCircle(creature.Manager));
                    }
                    creature.Creature.SelectionCircle.SetFlagRecursive(GameComponent.Flag.Visible, true);
                    creature.Creature.Sprite.DrawSilhouette = true;
                }
            }

            foreach (Room zone in GetRooms())
            {
                zone.ZoneBodies.RemoveAll(body => body.IsDead);
            }

            Designations.CleanupDesignations();

            foreach (var zone in RoomBuilder.DesignatedRooms)
            {
                zone.Update();
            }

            if (HandleThreatsTimer == null)
            {
                HandleThreatsTimer = new Timer(1.0f, false, Timer.TimerMode.Real
                                               );
            }

            HandleThreatsTimer.Update(time);
            if (HandleThreatsTimer.HasTriggered)
            {
                HandleThreats();
            }

            OwnedObjects.RemoveAll(obj => obj.IsDead);
        }
示例#2
0
        public void Update(DwarfTime time)
        {
            RoomBuilder.Faction  = this;
            CraftBuilder.Faction = this;
            RoomBuilder.CheckRemovals();

            Minions.RemoveAll(m => m.IsDead);
            SelectedMinions.RemoveAll(m => m.IsDead);

            foreach (var m in Minions)
            {
                m.Creature.SelectionCircle.SetFlagRecursive(GameComponent.Flag.Visible, false);
                m.Creature.Sprite.DrawSilhouette = false;
            }
            ;

            foreach (CreatureAI creature in SelectedMinions)
            {
                creature.Creature.SelectionCircle.SetFlagRecursive(GameComponent.Flag.Visible, true);
                creature.Creature.Sprite.DrawSilhouette = true;
            }

            foreach (Room zone in GetRooms())
            {
                zone.ZoneBodies.RemoveAll(body => body.IsDead);
            }

            Designations.CleanupDesignations();

            foreach (var zone in RoomBuilder.DesignatedRooms)
            {
                zone.Update();
            }

            HandleThreatsTimer.Update(time);
            if (HandleThreatsTimer.HasTriggered)
            {
                HandleThreats();
            }

            OwnedObjects.RemoveAll(obj => obj.IsDead);
        }