Example #1
0
 protected bool FindGuardCharacter()
 {
     if (GuardCharacter == null)
     {
         //use the guard node to get the character
         if (GuardNode.HasOccupant)
         {
             if (!GuardNode.Occupant.Is <Character> (out GuardCharacter) || GuardCharacter.IsDead)
             {
                 //Debug.Log ("Couldn't get character from guard node occupant, quitting in " + name);
                 return(false);
             }
             DailyRoutine dr = null;
             if (GuardNode.Occupant.Has <DailyRoutine> (out dr))
             {
                 //guard nodes don't get to have routines
                 dr.Finish();
             }
         }
         else
         {
             //Debug.Log ("Guard node didn't have occupant, quitting in " + name);
             WIGroup group = null;
             if (WIGroups.FindGroup(GuardNode.State.ParentGroupPath, out group))
             {
                 Characters.GetOrSpawnCharacter(GuardNode, GuardNode.State.OccupantName, group, out GuardCharacter);
             }
             return(GuardCharacter != null);
         }
     }
     return(true);
 }