forked from cgvr/DeltaVR
printer input hole animation
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using FMOD.Studio;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,12 +10,15 @@ public class Printer3D : MonoBehaviour
|
||||
public int ignorePlayerCollisionLayer = 2;
|
||||
public string shapeScannerTag = "ShapeScannable";
|
||||
|
||||
private bool isPrinting = false;
|
||||
private EventInstance printingSound;
|
||||
private GameObject GeneratedModel;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
printingSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Printing);
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -25,6 +29,10 @@ public class Printer3D : MonoBehaviour
|
||||
|
||||
public async void PrintObject(Texture2D texture)
|
||||
{
|
||||
isPrinting = true;
|
||||
printingSound.start();
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 0);
|
||||
|
||||
string encodedTexture = Convert.ToBase64String(texture.EncodeToJPG());
|
||||
byte[] encodedModel = await TrellisClient.Instance.GenerateModel(encodedTexture);
|
||||
|
||||
@@ -36,6 +44,9 @@ public class Printer3D : MonoBehaviour
|
||||
GeneratedModel.transform.position = Vector3.zero;
|
||||
}
|
||||
GeneratedModel = spawnedObject;
|
||||
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
|
||||
isPrinting = false;
|
||||
}
|
||||
|
||||
private void InitializeSpawnedObject(GameObject spawnedObject)
|
||||
@@ -59,4 +70,9 @@ public class Printer3D : MonoBehaviour
|
||||
|
||||
spawnedObjectParent.AddComponent<TwoHandScaleGrabInteractable>();
|
||||
}
|
||||
|
||||
public bool IsPrinting()
|
||||
{
|
||||
return isPrinting;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user