Exemplo n.º 1
0
 public static int GetParryCounter(Pawn pawn, bool increase)
 {
     // We scan the list pruning null references and increase the counter if we find the pawn in it
     // If the pawn isn't found we create a new entry on the list
     // We return the current counter
     foreach (MRpawntoken p in Pawntokens)
     {
         if (p.pawn == null)
         {
             Pawntokens.Remove(p);
         }
         else
         {
             if (p.pawn.Equals(pawn))
             {
                 if (increase)
                 {
                     p.counter++;
                 }
                 return(p.counter);
             }
         }
     }
     Pawntokens.Add(new MRpawntoken(pawn));
     return(Pawntokens.Last().counter);
 }
Exemplo n.º 2
0
 public static MRpawntoken GetPawnToken(Pawn pawn)
 {
     // We scan the list pruning null references and if we find the pawn in it we return the full token
     // If the pawn isn't found we create a new entry on the list with defaults
     foreach (MRpawntoken p in Pawntokens)
     {
         if (p.pawn == null)
         {
             Pawntokens.Remove(p);
         }
         else
         {
             if (p.pawn.Equals(pawn))
             {
                 return(p);
             }
         }
     }
     Pawntokens.Add(new MRpawntoken(pawn));
     return(Pawntokens.Last());
 }