Exemple #1
0
        /// <summary>
        /// Создает воздушное судно без дополнительной информации
        /// </summary>
        public ComponentDirective(ComponentDirective toCopy) : this()
        {
            if (toCopy == null)
            {
                return;
            }

            Cost            = toCopy.Cost;
            ComponentId     = toCopy.ComponentId;
            DirectiveTypeId = toCopy.DirectiveTypeId;
            FaaFormFileId   = toCopy.FaaFormFileId;
            HiddenRemarks   = toCopy.HiddenRemarks;
            Highlight       = toCopy.Highlight;
            IsClosed        = toCopy.IsClosed;
            KitRequired     = toCopy.KitRequired;
            ManHours        = toCopy.ManHours;
            MPDTaskType     = toCopy.MPDTaskType;
            ParentComponent = toCopy.ParentComponent;
            Remarks         = toCopy.Remarks;
            _threshold      = toCopy.Threshold;

            FaaFormFile = toCopy.FaaFormFile;

            if (_performanceRecords == null)
            {
                _performanceRecords = new BaseRecordCollection <DirectiveRecord>();
            }
            _performanceRecords.Clear();
            foreach (DirectiveRecord directiveRecord in toCopy.PerformanceRecords)
            {
                _performanceRecords.Add(new DirectiveRecord(directiveRecord)
                {
                    Parent = this, ParentId = ItemId
                });
            }

            if (Kits == null)
            {
                Kits = new CommonCollection <AccessoryRequired>();
            }
            Kits.Clear();
            foreach (AccessoryRequired kit in toCopy.Kits)
            {
                Kits.Add(new AccessoryRequired(kit)
                {
                    ParentObject = this, ParentId = ItemId
                });
            }
        }
Exemple #2
0
 /// <summary>
 /// Создание и удаление аптечек
 /// </summary>
 private static void UpdateKits()
 {
     if (Kits.Count == 0 && Rand.Next(0, St.KitAppearence) == Rand.Next(0, St.KitAppearence) && Ship?.Health < St.SpaceShipMaxHealth * 0.5) // Создание новых аптечек
     {
         Kits.Add(new Kit(new Point(St.FieldMaxWidth - Kit.Img.Size.Width, Rand.Next(Kit.Img.Size.Height, St.FieldMaxHeight - Kit.Img.Size.Height)),
                          new Point(-St.KitDir[DiffLvl], Rand.Next(-St.KitDir[DiffLvl], St.KitDir[DiffLvl]))));
     }
     for (int i = Kits.Count - 1; i >= 0; i--) // Обновление и удаление пропущенных аптечек
     {
         Kits[i].Update();
         if (Kits[i].Pos.X + Kit.Img.Size.Width < 0)
         {
             Kits[i].Del(Kits, i);
         }
     }
 }