예제 #1
0
        public void Update()
        {
            int dt = -updateTimer.TicksLeft;

            if (dt >= 1000)
            {
                GUnit[] units = GObjectList.GetUnits();
                Update(units);
            }
        }
예제 #2
0
 public void Update()
 {
     lock (this)
     {
         if (continent == null)
         {
             return;
         }
         if (NPCs == null)
         {
             return;
         }
         GUnit[] units = GObjectList.GetUnits();
         foreach (GUnit unit in units)
         {
             if ((unit.Reaction == GReaction.Friendly || unit.Reaction == GReaction.Neutral) &&
                 !unit.IsPlayer &&
                 unit.CreatureType != GCreatureType.Critter &&
                 unit.CreatureType != GCreatureType.Totem &&
                 !PPather.IsPlayerFaction(unit))
             {
                 string name = unit.Name;
                 NPC    n    = null;
                 if (!NPCs.TryGetValue(name, out n))
                 {
                     n          = new NPC();
                     n.name     = name;
                     n.faction  = unit.FactionID;
                     n.location = unit.Location;
                     n.reaction = unit.Reaction;
                     PPather.WriteLine("New NPC found: " + name);
                     NPCs.Add(name, n);
                     changed = true;
                 }
             }
         }
     }
 }