Exemplo n.º 1
0
 public static Part CreatePart(ReferencePart referencePart, float durability = 1f)
 {
     if (referencePart != null)
     {
         return(referencePart.CreatePart(durability));
     }
     return(null);
 }
Exemplo n.º 2
0
        public ReferencePart GetReferencePart(int id)
        {
            ReferencePart result = _hulls.FirstOrDefault(x => x.Id == id);

            if (result != null)
            {
                return(result);
            }
            result = _fuelTanks.FirstOrDefault(x => x.Id == id);
            if (result != null)
            {
                return(result);
            }
            result = _engines.FirstOrDefault(x => x.Id == id);
            if (result != null)
            {
                return(result);
            }
            result = _cargos.FirstOrDefault(x => x.Id == id);
            if (result != null)
            {
                return(result);
            }
            result = _coolings.FirstOrDefault(x => x.Id == id);
            if (result != null)
            {
                return(result);
            }
            result = _batteries.FirstOrDefault(x => x.Id == id);
            if (result != null)
            {
                return(result);
            }
            result = _drills.FirstOrDefault(x => x.Id == id);
            if (result != null)
            {
                return(result);
            }
            throw new PartNotFoundException("Part cannot be found (id: " + id.ToString() + ")");
        }