示例#1
0
 public Ammunition(SuppliesStorage start, Enum type, String name)
 {
     Used    = false;
     HeldBy  = start;
     Caliber = type;
     Name    = name;
 }
示例#2
0
 public SubUnit(string name)
 {
     Name         = name;
     Storage      = new SuppliesStorage(1000);
     SoftAttack   = 0;
     HardAttack   = 0;
     Piercing     = 0;
     Integrity    = 0;
     Organization = 0;
     Speed        = 0;
     Armor        = 0;
     Readiness    = 0;
     Entrenchment = 0;
     Defense      = 0;
     CombatWidth  = 0;
 }
示例#3
0
        public List <Equipment> takeItem(String name, int amount, Unit unit = null, SuppliesStorage newStorage = null)
        {
            List <Equipment> returnList = new List <Equipment>();

            int amountCount = 0;

            foreach (Equipment i in storage)
            {
                if ((i.Name == name) && (amountCount < amount))
                {
                    returnList.Add(i);
                    if (unit != null)
                    {
                        unit.Storage.addItem(i);
                    }
                    else if (newStorage != null)
                    {
                        newStorage.addItem(i);
                    }
                    else
                    {
                        throw new ArgumentException("Both unit and newStorage cannot be null");
                    }
                    weight = weight - i.Weight;
                    amountCount++;
                    if (amountCount == amount)
                    {
                        break;
                    }
                }
            }

            if (returnList.Count() > 0)
            {
                return(returnList);
            }

            return(null);
        }
示例#4
0
 public MapSpace(int X, int Y)
 {
     this.X  = X;
     this.Y  = Y;
     Storage = new SuppliesStorage(double.MaxValue);
 }