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()); } }
public virtual BaseTemplate Clone(string newName) { BaseTemplate obj = Create(); CopyTo(obj); obj.Name = newName; return(obj); }
public static BaseTemplate AddTemplate(BaseTemplate template) { if (template == null || string.IsNullOrEmpty(template.Name)) { return(null); } template.ID = LastTemplateID++; Templates.Add(template); return(template); }
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()); }