forked from cgvr/DeltaVR
shape detection npc speaks from radio, avoid interrupting voicelines
This commit is contained in:
Binary file not shown.
@@ -146,8 +146,7 @@ public abstract class NPCController : MonoBehaviour
|
|||||||
|
|
||||||
protected virtual void OnPlayerLeave() {}
|
protected virtual void OnPlayerLeave() {}
|
||||||
|
|
||||||
|
public void SpeakVoiceLine(int voiceLineId, GameObject emitter = null, float radioAmount = 0f)
|
||||||
public void SpeakVoiceLine(int voiceLineId)
|
|
||||||
{
|
{
|
||||||
if (voiceLineId < 0 || voiceLineId >= voiceLineKeys.Length)
|
if (voiceLineId < 0 || voiceLineId >= voiceLineKeys.Length)
|
||||||
{
|
{
|
||||||
@@ -163,7 +162,8 @@ public abstract class NPCController : MonoBehaviour
|
|||||||
|
|
||||||
LoadCurve(key); // load RMS data
|
LoadCurve(key); // load RMS data
|
||||||
|
|
||||||
currentVoicelineEvent = AudioManager.Instance.PlayDialogue(characterSpecificFolder + "/" + key, gameObject);
|
emitter = emitter ?? gameObject;
|
||||||
|
currentVoicelineEvent = AudioManager.Instance.PlayDialogue(characterSpecificFolder + "/" + key, emitter, radioAmount);
|
||||||
if (!currentVoicelineEvent.isValid())
|
if (!currentVoicelineEvent.isValid())
|
||||||
{
|
{
|
||||||
Debug.LogError("Failed to start dialogue event.");
|
Debug.LogError("Failed to start dialogue event.");
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public class ShapeDetectionNPC : NPCController
|
|||||||
public Texture2D GeneratedTexture { get; private set; }
|
public Texture2D GeneratedTexture { get; private set; }
|
||||||
public Image imageDisplay;
|
public Image imageDisplay;
|
||||||
public ShapeScanner shapeScanner;
|
public ShapeScanner shapeScanner;
|
||||||
|
public float radioAmount = 1f;
|
||||||
|
|
||||||
public GameObject GeneratedModel { get; private set; }
|
public GameObject GeneratedModel { get; private set; }
|
||||||
public Transform modelSpawnPoint;
|
public Transform modelSpawnPoint;
|
||||||
@@ -79,18 +80,22 @@ public class ShapeDetectionNPC : NPCController
|
|||||||
{
|
{
|
||||||
if (state == 1)
|
if (state == 1)
|
||||||
{
|
{
|
||||||
SpeakVoiceLine(0);
|
SpeakVoiceLine(0, radio.gameObject, radioAmount);
|
||||||
await Task.Delay(2000);
|
await Task.Delay(2000);
|
||||||
SpeakVoiceLine(1);
|
// Has the player maybe picked up the radio during the last 2 seconds?
|
||||||
|
if (state == 1)
|
||||||
|
{
|
||||||
|
SpeakVoiceLine(1, radio.gameObject, radioAmount);
|
||||||
Invoke(nameof(CallPlayer), 4f);
|
Invoke(nameof(CallPlayer), 4f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void OnPlayerPickedUpRadio()
|
private async void OnPlayerPickedUpRadio()
|
||||||
{
|
{
|
||||||
if (state == 1)
|
if (state == 1)
|
||||||
{
|
{
|
||||||
SpeakVoiceLine(2);
|
SpeakVoiceLine(2, radio.gameObject, radioAmount);
|
||||||
state = 2;
|
state = 2;
|
||||||
await Task.Delay(5000);
|
await Task.Delay(5000);
|
||||||
questMarker.MoveTo(microphoneStand.transform);
|
questMarker.MoveTo(microphoneStand.transform);
|
||||||
@@ -102,7 +107,7 @@ public class ShapeDetectionNPC : NPCController
|
|||||||
{
|
{
|
||||||
if (state == 2)
|
if (state == 2)
|
||||||
{
|
{
|
||||||
SpeakVoiceLine(3);
|
SpeakVoiceLine(3, radio.gameObject, radioAmount);
|
||||||
state = 3;
|
state = 3;
|
||||||
questMarker.MoveTo(imageGenerationButton.transform);
|
questMarker.MoveTo(imageGenerationButton.transform);
|
||||||
}
|
}
|
||||||
@@ -119,7 +124,7 @@ public class ShapeDetectionNPC : NPCController
|
|||||||
imageGenerationButton.Deactivate();
|
imageGenerationButton.Deactivate();
|
||||||
if (state == 3)
|
if (state == 3)
|
||||||
{
|
{
|
||||||
SpeakVoiceLine(4);
|
SpeakVoiceLine(4, radio.gameObject, radioAmount);
|
||||||
state = 4;
|
state = 4;
|
||||||
questMarker.MoveTo(modelGenerationButton.transform);
|
questMarker.MoveTo(modelGenerationButton.transform);
|
||||||
modelGenerationButton.Deactivate();
|
modelGenerationButton.Deactivate();
|
||||||
@@ -130,7 +135,7 @@ public class ShapeDetectionNPC : NPCController
|
|||||||
{
|
{
|
||||||
if (state == 4)
|
if (state == 4)
|
||||||
{
|
{
|
||||||
SpeakVoiceLine(5);
|
SpeakVoiceLine(5, radio.gameObject, radioAmount);
|
||||||
state = 5;
|
state = 5;
|
||||||
questMarker.MoveTo(shapeScanner.transform);
|
questMarker.MoveTo(shapeScanner.transform);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user