示例#1
0
        public static Lord MakeNewLord(Faction faction, LordJob lordJob, Map map, IEnumerable <Pawn> startingPawns = null)
        {
            Lord result;

            if (map == null)
            {
                Log.Warning("Tried to create a lord with null map.", false);
                result = null;
            }
            else
            {
                Lord lord = new Lord();
                lord.loadID  = Find.UniqueIDsManager.GetNextLordID();
                lord.faction = faction;
                map.lordManager.AddLord(lord);
                lord.SetJob(lordJob);
                lord.GotoToil(lord.Graph.StartingToil);
                if (startingPawns != null)
                {
                    foreach (Pawn p in startingPawns)
                    {
                        lord.AddPawn(p);
                    }
                }
                result = lord;
            }
            return(result);
        }
示例#2
0
 public void Execute(Lord lord)
 {
     if (!this.canMoveToSameState && this.target == lord.CurLordToil)
     {
         return;
     }
     for (int i = 0; i < this.preActions.Count; i++)
     {
         this.preActions[i].DoAction(this);
     }
     lord.GotoToil(this.target);
     for (int j = 0; j < this.postActions.Count; j++)
     {
         this.postActions[j].DoAction(this);
     }
 }
示例#3
0
 public void Execute(Lord lord)
 {
     if (canMoveToSameState || target != lord.CurLordToil)
     {
         for (int i = 0; i < preActions.Count; i++)
         {
             preActions[i].DoAction(this);
         }
         if (target != lord.CurLordToil || updateDutiesIfMovedToSameState)
         {
             lord.GotoToil(target);
         }
         for (int j = 0; j < postActions.Count; j++)
         {
             postActions[j].DoAction(this);
         }
     }
 }