public void InitShipWithBlueprint(Ship ship, BlueprintNew bp) { ship.Id = IdGenerator.GenShipId(); ship.Blueprint = bp; ShipClass shipClass = BlueprintManager.Instance.GetShipClass(bp.ShipClassId); ship.ShipClass = shipClass; // All ships have a cargo component CmpCargo cargo = ship.gameObject.AddComponent <CmpCargo>() as CmpCargo; foreach (string id in bp.ShipAttachmentIds) { var attachment = BlueprintManager.Instance.GetAttachment(id); AddAttachmentByType[attachment.Type](ship, attachment); } foreach (string id in bp.ShipThrusterIds) { var thruster = BlueprintManager.Instance.GetThruster(id); AddThruster(ship, thruster); } foreach (string id in bp.ShipEquipmentIds) { var equipment = BlueprintManager.Instance.GetEquipment(id); AddEquipmentByType[equipment.Type](ship, equipment); } InitShipComponents(ship); FinalizeShip(ship); }