Ejemplo n.º 1
0
        private bool AddUnit(List<Unit> unitList, int slotsAvailable, Unit unit)
        {
            if (unitList.Count >= slotsAvailable)
            {
                return false;
            }

            if (unit.IsUnique && unitList.Count(x => (x.Name == unit.Name)) > 0)
            {
                return false;
            }

            unitList.Add(unit);
            return true;
        }
Ejemplo n.º 2
0
        public bool AddReinforcement(Unit unit, int count)
        {
            if (Reinforcements.Count >= MAX_REINFORCEMENTS)
            {
                return false; // Reinforcements full
            }

            if (Reinforcements.Count(x => (x.Unit.Name == unit.Name)) > 0)
            {
                return false; // Already in List
            }

            if (unit.IsUnique)
            {
                count = 1;
            }

            Reinforcements.Add(new Reinforcement(unit, count));
            return true;
        }
Ejemplo n.º 3
0
        public bool AddUnit(Unit unit)
        {
            if (Formation == null)
            {
                return false;
            }

            if (unit.IsClassification(Classification.Commander))
            {
                return AddUnit(Commanders, Formation.CommanderSlots, unit);
            }

            if (unit.IsClassification(Classification.Assault))
            {
                return AddUnit(AssaultUnits, Formation.AssaultSlots, unit);
            }

            if (unit.IsClassification(Classification.Structure))
            {
                return AddUnit(Structures, Formation.StructureSlots, unit);
            }

            if (unit.IsClassification(Classification.Vindicator))
            {
                return AddUnit(Vindicators, Formation.VindicatorSlots, unit);
            }

            return false; // Unknown
        }
Ejemplo n.º 4
0
 public Reinforcement(Unit unit, int numAvailable)
 {
     Unit = unit;
     NumAvailable = numAvailable;
 }