public void AddUsedUnit(int key, IBattlePoolUnit unit)
    {
        if (!battlePools.ContainsKey(key))
        {
            battlePools.Add(key, new BattlePool());
        }

        battlePools[key].AddUsedUnit(unit);
    }
Exemple #2
0
 public void Recycle(IBattlePoolUnit unit)
 {
     if (usedUnits.Remove(unit))
     {
         unusedUnits.Enqueue(unit);
     }
     else
     {
         DebugUtils.Assert(false, "Battle Pool: can't recycle a battle unit " + unit.ToString());
     }
 }
Exemple #3
0
 public IBattlePoolUnit GetUnit()
 {
     if (unusedUnits.Count > 0)
     {
         IBattlePoolUnit unit = unusedUnits.Dequeue();
         usedUnits.Add(unit);
         return(unit);
     }
     else
     {
         return(null);
     }
 }
Exemple #4
0
 public void AddUsedUnit(IBattlePoolUnit unit)
 {
     unit.pool = this;
     usedUnits.Add(unit);
 }