forked from cgvr/DeltaVR
added Radio model, npc correctly speaks when interacting with elements
This commit is contained in:
@@ -7,10 +7,10 @@ public class ShapeDetectionNPC : NPCController
|
||||
{
|
||||
[Header("Shape Detection Minigame Config")]
|
||||
public QuestMarker questMarker;
|
||||
public MicrophoneStand microphoneStand;
|
||||
public RadioTransmitter radio;
|
||||
public PushableButton imageGenerationButton;
|
||||
public PushableButton modelGenerationButton;
|
||||
public Transform computerKeyboardKey;
|
||||
public ComputerPrinter computerPrinter;
|
||||
public Printer3DInputHole printerInsertionHole;
|
||||
public Texture2D GeneratedTexture { get; private set; }
|
||||
public Image imageDisplay;
|
||||
public ShapeScanner shapeScanner;
|
||||
@@ -37,9 +37,9 @@ public class ShapeDetectionNPC : NPCController
|
||||
private void Start()
|
||||
{
|
||||
radio.OnPlayerPickUp += OnPlayerPickedUpRadio;
|
||||
microphoneStand.OnPlayerFinishedSpeaking += OnPlayerUsedMicrophone;
|
||||
imageGenerationButton.OnButtonPressed += OnPlayerPressedKeyboard;
|
||||
modelGenerationButton.OnButtonPressed += OnPlayerInitiatedPrinting;
|
||||
radio.OnPlayerFinishedSpeaking += OnPlayerSpokeIntoRadio;
|
||||
computerPrinter.OnImagePrinted += OnPlayerPrintedImage;
|
||||
printerInsertionHole.OnPlayerInsertedPrintable += OnPlayerInitiatedPrinting;
|
||||
}
|
||||
|
||||
protected async override void OnPlayerApproach()
|
||||
@@ -54,7 +54,7 @@ public class ShapeDetectionNPC : NPCController
|
||||
{
|
||||
state = 1;
|
||||
await CallPlayer();
|
||||
await Task.Delay(2000);
|
||||
await Task.Delay(1000);
|
||||
questMarker.MoveTo(radio.transform, true);
|
||||
}
|
||||
}
|
||||
@@ -94,36 +94,26 @@ public class ShapeDetectionNPC : NPCController
|
||||
SpeakVoiceLine(2, radio.gameObject, radioAmount);
|
||||
state = 2;
|
||||
await Task.Delay(5000);
|
||||
questMarker.MoveTo(microphoneStand.transform);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: replace microphone with radio
|
||||
private void OnPlayerUsedMicrophone()
|
||||
private void OnPlayerSpokeIntoRadio()
|
||||
{
|
||||
if (state == 2)
|
||||
{
|
||||
SpeakVoiceLine(3, radio.gameObject, radioAmount);
|
||||
state = 3;
|
||||
questMarker.MoveTo(imageGenerationButton.transform);
|
||||
questMarker.MoveTo(computerKeyboardKey);
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnPlayerPressedKeyboard()
|
||||
private void OnPlayerPrintedImage()
|
||||
{
|
||||
//string inputPrompt = microphoneStand.GetTextOutput();
|
||||
//byte[] imageBytes = await InvokeAiClient.Instance.GenerateImage(inputPrompt);
|
||||
//GeneratedTexture = ModelGenerationUtils.CreateTexture(imageBytes);
|
||||
//Sprite sprite = ModelGenerationUtils.CreateSprite(GeneratedTexture);
|
||||
//imageDisplay.sprite = sprite;
|
||||
|
||||
imageGenerationButton.Deactivate();
|
||||
if (state == 3)
|
||||
{
|
||||
SpeakVoiceLine(4, radio.gameObject, radioAmount);
|
||||
state = 4;
|
||||
questMarker.MoveTo(modelGenerationButton.transform);
|
||||
modelGenerationButton.Deactivate();
|
||||
questMarker.MoveTo(printerInsertionHole.transform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,14 +131,10 @@ public class ShapeDetectionNPC : NPCController
|
||||
|
||||
GameObject spawnedObject = await ModelGenerationUtils.Instance.SpawnModel(encodedModel);
|
||||
|
||||
|
||||
modelGenerationButton.Deactivate();
|
||||
|
||||
if (state == 5)
|
||||
{
|
||||
state = 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user