示例#1
0
        protected override void CopyTo(BaseTemplate newTemplate)
        {
            base.CopyTo(newTemplate);
            ShipTemplate newShip = newTemplate as ShipTemplate;

            if (newShip == null)
            {
                return;
            }

            newShip.ImpulseSpeed        = ImpulseSpeed;
            newShip.ImpulseAcceleration = ImpulseAcceleration;
            newShip.TurnSpeed           = TurnSpeed;
            newShip.WarpSpeed           = WarpSpeed;
            newShip.IsPlayable          = IsPlayable;
            newShip.FuelCapacity        = FuelCapacity;
            newShip.MaxRepairCrew       = MaxRepairCrew;

            foreach (var i in DockingPorts)
            {
                newShip.DockingPorts.Add(i.Clone());
            }

            foreach (var w in Weapons)
            {
                newShip.Weapons.Add(new HardpointID(w.Key), w.Value.Clone());
            }
        }
示例#2
0
        public virtual BaseTemplate Clone(string newName)
        {
            BaseTemplate obj = Create();

            CopyTo(obj);
            obj.Name = newName;
            return(obj);
        }
示例#3
0
        public static BaseTemplate AddTemplate(BaseTemplate template)
        {
            if (template == null || string.IsNullOrEmpty(template.Name))
            {
                return(null);
            }

            template.ID = LastTemplateID++;

            Templates.Add(template);
            return(template);
        }
示例#4
0
        protected virtual void CopyTo(BaseTemplate newTemplate)
        {
            newTemplate.Name          = Name;
            newTemplate.DisplayName   = DisplayName;
            newTemplate.ClassName     = ClassName;
            newTemplate.SubClassName  = SubClassName;
            newTemplate.Description   = Description;
            newTemplate.ModelName     = ModelName;
            newTemplate.RadarTrace    = RadarTrace;
            newTemplate.DefaultAIName = DefaultAIName;

            newTemplate.Hull    = Hull;
            newTemplate.Shields = new List <float>(Shields.ToArray());
        }