forked from cgvr/DeltaVR
new table model in archery range, disable buttons at first, play printing sound
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using FMOD.Studio;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -7,16 +8,21 @@ public class ModelDisplay : MonoBehaviour
|
||||
public Transform displayPoint;
|
||||
public Transform glassTransform;
|
||||
public Material modelDisplayActiveMaterial;
|
||||
public Transform wire;
|
||||
public MeshRenderer[] wires;
|
||||
public Material wireActiveMaterial;
|
||||
|
||||
public GameObject Model { get; private set; }
|
||||
public float generatedObjectRotationSpeed = 10f;
|
||||
|
||||
private EventInstance printingSound;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
printingSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Printing);
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
|
||||
printingSound.setParameterByName("Occlusion", 0);
|
||||
printingSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(displayPoint));
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -28,9 +34,15 @@ public class ModelDisplay : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void StartPrinting()
|
||||
{
|
||||
printingSound.start();
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 0);
|
||||
}
|
||||
|
||||
public void DisplayModel(GameObject modelObject)
|
||||
{
|
||||
foreach (MeshRenderer meshRenderer in wire.GetComponentsInChildren<MeshRenderer>())
|
||||
foreach (MeshRenderer meshRenderer in wires)
|
||||
{
|
||||
meshRenderer.material = wireActiveMaterial;
|
||||
}
|
||||
@@ -43,5 +55,7 @@ public class ModelDisplay : MonoBehaviour
|
||||
modelObject.transform.parent = displayPoint;
|
||||
modelObject.transform.position = displayPoint.position;
|
||||
Model = modelObject;
|
||||
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using FMOD.Studio;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class ArcheryRangeNPC : NPCController
|
||||
@@ -18,7 +17,6 @@ public class ArcheryRangeNPC : NPCController
|
||||
public Transform startTargetQuestMarkerPoint;
|
||||
|
||||
private Texture2D GeneratedTexture;
|
||||
private EventInstance printingSound;
|
||||
|
||||
// states:
|
||||
// 0 - idle
|
||||
@@ -39,9 +37,6 @@ public class ArcheryRangeNPC : NPCController
|
||||
microphoneStand.OnPlayerFinishedSpeaking += OnPlayerUsedMicrophone;
|
||||
imageGenerationButton.OnButtonPressed += OnImageGenerationButtonPressed;
|
||||
modelGenerationButton.OnButtonPressed += OnModelGenerationButtonPressed;
|
||||
|
||||
printingSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Printing);
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
|
||||
}
|
||||
|
||||
protected async override void OnPlayerApproach()
|
||||
@@ -64,7 +59,7 @@ public class ArcheryRangeNPC : NPCController
|
||||
|
||||
protected override void OnPlayerLeave()
|
||||
{
|
||||
Debug.Log("Alien NPC: player left");
|
||||
|
||||
}
|
||||
|
||||
private void OnPlayerUsedMicrophone()
|
||||
@@ -73,6 +68,7 @@ public class ArcheryRangeNPC : NPCController
|
||||
{
|
||||
SpeakVoiceLine(3);
|
||||
questMarker.MoveTo(imageGenerationButton.transform);
|
||||
imageGenerationButton.Deactivate();
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
@@ -106,9 +102,7 @@ public class ArcheryRangeNPC : NPCController
|
||||
state = 4;
|
||||
}
|
||||
|
||||
printingSound.start();
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 0);
|
||||
|
||||
modelDisplay.StartPrinting();
|
||||
string encodedTexture = Convert.ToBase64String(GeneratedTexture.EncodeToJPG());
|
||||
byte[] encodedModel = await TrellisClient.Instance.GenerateModel(encodedTexture);
|
||||
|
||||
@@ -122,7 +116,6 @@ public class ArcheryRangeNPC : NPCController
|
||||
state = 5;
|
||||
}
|
||||
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
|
||||
modelGenerationButton.Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user