Beispiel #1
0
 public void RemoveDigDesignation(Voxel vox)
 {
     if (DigDesignations.ContainsKey(vox.QuickCompare))
     {
         DigDesignations.Remove(vox.QuickCompare);
     }
 }
Beispiel #2
0
 public void AddDigDesignation(BuildOrder order)
 {
     if (order.Vox == null)
     {
         return;
     }
     DigDesignations.Add(order.Vox.QuickCompare, order);
 }
Beispiel #3
0
        public BuildOrder GetDigDesignation(Voxel vox)
        {
            BuildOrder returnOrder;

            if (DigDesignations.TryGetValue(vox.QuickCompare, out returnOrder))
            {
                return(returnOrder);
            }
            return(new BuildOrder());
        }
Beispiel #4
0
        public bool IsDigDesignation(Voxel vox)
        {
            GamePerformance.Instance.TrackValueType <int>("Dig Designations", DigDesignations.Count);

            return(DigDesignations.ContainsKey(vox.QuickCompare));

            /*
             * for (int i = 0; i < DigDesignations.Count; i++)
             * {
             *  if (DigDesignations[i].Vox.IsSameAs(vox)) return true;
             * }
             * return false;
             * */
        }
Beispiel #5
0
        public void Update(DwarfTime time)
        {
            RoomBuilder.Faction  = this;
            CraftBuilder.Faction = this;
            WallBuilder.Faction  = this;
            RoomBuilder.CheckRemovals();

            Minions.RemoveAll(m => m.IsDead);
            SelectedMinions.RemoveAll(m => m.IsDead);
            Minions.ForEach(m =>
            {
                m.Creature.SelectionCircle.IsVisible = false;
                m.Creature.Sprite.DrawSilhouette     = false;
            });
            SelectedMinions.ForEach(m => {
                m.Creature.SelectionCircle.IsVisible = true;
                m.Creature.Sprite.DrawSilhouette     = true;
            }

                                    );

            // Turned off until a non-O(n^2) collision method is create.
            //CollideMinions(time);

            List <ulong> removalKeys = new List <ulong>();

            foreach (KeyValuePair <ulong, BuildOrder> kvp in DigDesignations)
            {
                Voxel v = kvp.Value.Vox;
                if (v.IsEmpty || v.Health <= 0.0f || v.Type.Name == "empty" || v.Type.IsInvincible)
                {
                    removalKeys.Add(kvp.Key);
                }
            }

            for (int i = 0; i < removalKeys.Count; i++)
            {
                DigDesignations.Remove(removalKeys[i]);
            }

            List <Body> gatherRemovals = (from b in GatherDesignations
                                          where b == null || b.IsDead
                                          select b).ToList();

            foreach (Body b in gatherRemovals)
            {
                GatherDesignations.Remove(b);
            }


            List <BuildOrder> removals = new List <BuildOrder>();

            foreach (BuildOrder d in GuardDesignations)
            {
                Voxel v = d.Vox;

                if (!v.IsEmpty && !(v.Health <= 0.0f) && v.Type.Name != "empty")
                {
                    continue;
                }

                removals.Add(d);

                if (!v.IsEmpty)
                {
                    v.Kill();
                }
            }

            foreach (BuildOrder v in removals)
            {
                GuardDesignations.Remove(v);
            }

            List <Body> treesToRemove = ChopDesignations.Where(tree => tree.IsDead).ToList();

            foreach (Body tree in treesToRemove)
            {
                ChopDesignations.Remove(tree);
            }

            List <Body> attacksToRemove = AttackDesignations.Where(body => body.IsDead).ToList();

            foreach (Body body in attacksToRemove)
            {
                AttackDesignations.Remove(body);
            }

            HandleThreats();
        }
Beispiel #6
0
 public bool IsDigDesignation(Voxel vox)
 {
     return(DigDesignations.Select(d => d.Vox).Select(vref => vref).Any(vox.Equals));
 }
Beispiel #7
0
        public void Update(DwarfTime time)
        {
            RoomBuilder.CheckRemovals();

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

            CollideMinions(time);

            List <BuildOrder> removals = (from d in DigDesignations
                                          let vref = d.Vox
                                                     let v = vref
                                                             where v.IsEmpty || v.Health <= 0.0f || v.Type.Name == "empty" || v.Type.IsInvincible
                                                             select d).ToList();

            foreach (BuildOrder v in removals)
            {
                DigDesignations.Remove(v);
            }

            List <Body> gatherRemovals = (from b in GatherDesignations
                                          where b == null || b.IsDead
                                          select b).ToList();

            foreach (Body b in gatherRemovals)
            {
                GatherDesignations.Remove(b);
            }


            removals.Clear();
            foreach (BuildOrder d in GuardDesignations)
            {
                Voxel v = d.Vox;

                if (!v.IsEmpty && !(v.Health <= 0.0f) && v.Type.Name != "empty")
                {
                    continue;
                }

                removals.Add(d);

                if (!v.IsEmpty)
                {
                    v.Kill();
                }
            }

            foreach (BuildOrder v in removals)
            {
                GuardDesignations.Remove(v);
            }

            List <Body> treesToRemove = ChopDesignations.Where(tree => tree.IsDead).ToList();

            foreach (Body tree in treesToRemove)
            {
                ChopDesignations.Remove(tree);
            }

            List <Body> attacksToRemove = AttackDesignations.Where(body => body.IsDead).ToList();

            foreach (Body body in attacksToRemove)
            {
                AttackDesignations.Remove(body);
            }

            HandleThreats();
        }