void Update() { if (printDrive) { if (printDrive.transform.localPosition != desiredLocation) { printDrive.transform.localPosition = Vector3.MoveTowards(printDrive.transform.localPosition, desiredLocation, insertionSpeed * Time.deltaTime); } else if (!driveConnected) { ConnectDrive(); } if (desiredLocation != Vector3.zero && printDrive.transform.localPosition == desiredLocation) { Destroy(printDrive.gameObject); printDrive = null; if (blueprint) { gameObject.layer = LayerMask.GetMask("Default"); Destroy(blueprint); Destroy(this); } else { FindObjectOfType <WeaponSlot>().SwitchWeapons(); } } } }
public void Unlock(PrintDrive drive) { if (!unlocked) { PartPrinterData.instance.UnlockModule(moduleType, moduleTier); drive.ShowBlueprint(moduleType, moduleTier); unlocked = true; } }
public void Use() { if (!printDrive) { printDrive = Instantiate(PartPrinterData.instance.printDrivePrefab, transform.position + transform.up / 2f, transform.rotation, transform).GetComponent <PrintDrive>(); printDrive.AssignPort(this); if (!blueprint) { FindObjectOfType <WeaponSlot>().UnequipAll(); } desiredLocation = Vector3.zero; } }