void FixedUpdate()
 {
     if (debug_CraftToSave != null)
     {
         debug_CraftBlueprint = CraftBlueprint.GetBlueprintFromCraft(debug_CraftToSave);
         debug_CraftToSave    = null;
     }
     if (debug_CraftBlueprint != null)
     {
         if (debug_SaveCraftBlueprint)
         {
             debug_SaveCraftBlueprint = false;
             CraftBlueprint.SaveToFile(debug_CraftBlueprint);
         }
         if (debug_LoadCraftBlueprint)
         {
             debug_LoadCraftBlueprint = false;
             debug_CraftBlueprint     = CraftBlueprint.LoadFromFileByName(debug_LoadCraftBlueprintFileName);
         }
         if (debug_SpawnCraftBlueprint)
         {
             CraftBlueprint.SpawnCraftFromBlueprint(debug_CraftBlueprint, Vector3.up * 10f, Vector3.zero);
             debug_SpawnCraftBlueprint = false;
         }
         if (debug_ForgetCraftBlueprint)
         {
             debug_ForgetCraftBlueprint = false;
             debug_CraftBlueprint       = null;
         }
     }
 }
 public CraftBlueprint SaveCraft(bool overwriteCurrentSave = true)
 {
     if (overwriteCurrentSave)
     {
         savedCraft = CraftBlueprint.GetBlueprintFromCraft(GetComponent <MultipartPhysBody>());
         return(savedCraft);
     }
     else
     {
         return(CraftBlueprint.GetBlueprintFromCraft(GetComponent <MultipartPhysBody>()));
     }
 }
Beispiel #3
0
    public CraftBlueprint GetBlueprintFromCurrCraft()
    {
        //ignore held part
        if (currPart != null)
        {
            currPart.transform.SetParent(null);
            currPart.DestroyPartLite();
        }

        MultipartPhysBody physBody = currCraft.GetComponent <MultipartPhysBody>();

        physBody.UpdatePhysParts(true);
        foreach (PhysPart p in physBody.Parts)
        {
            p.connections = CalculatePartConnections(p);
        }
        return(CraftBlueprint.GetBlueprintFromCraft(physBody));
    }