public void EditCraftFromBlueprint(CraftBlueprint bp) { ClearCurrCraft(); PlayerManager.instance.SetCraftInputEnabled(false); PlayerManager.instance.PlayerCraft = null; PlayerManager.instance.playerCraftWasNull = true; //To prevent spawn menu from opening again currCraft = CraftBlueprint.SpawnCraftFromBlueprint(bp, transform.position, transform.eulerAngles); SmoothFollowCam camComp = PlayerManager.instance.cam; camComp.followTarget = CamLookTarget; camComp.lookMode = SmoothFollowCam.LookMode.ORBIT; camComp.freelook_xrot = 25; camComp.freelook_yrot = 0; camComp.rotation = 45; camComp.zoom = 1f; camRot = Vector2.zero; foreach (PhysPart part in currCraft.GetComponentsInChildren <PhysPart>()) { MakePartEditorFriendly(part); } currCraft.rb.isKinematic = true; currCraft.enabled = false; }
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 void SaveAndRespawn() { SaveCraft(); CraftBlueprint.SpawnCraftFromBlueprint(savedCraft, transform.GetChild(0).position, transform.GetChild(0).transform.eulerAngles); transform.position = Vector3.down * 55555f; Destroy(gameObject); gameObject.SetActive(false); }
public void SpawnCraft() { CraftBlueprint.SpawnCraftFromBlueprint(Blueprint, transform.position, transform.eulerAngles); }
public void SpawnCraftFromBlueprint(CraftBlueprint bp) { MultipartPhysBody craft = CraftBlueprint.SpawnCraftFromBlueprint(bp, SpawnPoint.position, SpawnPoint.eulerAngles); PlayerManager.instance.OnPlayerCraftSpawned(craft); }