forked from cgvr/DeltaVR
Compare commits
2 Commits
c07fb1fe1e
...
60951161ed
| Author | SHA1 | Date | |
|---|---|---|---|
| 60951161ed | |||
| 1f632c60bc |
@@ -9,6 +9,7 @@
|
|||||||
* npc character:
|
* npc character:
|
||||||
* klaas on näha temast eespool
|
* klaas on näha temast eespool
|
||||||
* voicelines: list listidest, mille hulgast saab valida
|
* voicelines: list listidest, mille hulgast saab valida
|
||||||
|
* Unity crash after stopping the game - most likely due to FMOD trying to do something with invalid audio instances
|
||||||
|
|
||||||
Can't/Won't Do:
|
Can't/Won't Do:
|
||||||
* glTF loading: vahetada ära shader Universal render pipeline Lit, mitte panna buildi kaasa glTf oma - **ei saa, objekt on siis ilma tekstuurita, lihtsalt hall**
|
* glTF loading: vahetada ära shader Universal render pipeline Lit, mitte panna buildi kaasa glTf oma - **ei saa, objekt on siis ilma tekstuurita, lihtsalt hall**
|
||||||
|
|||||||
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;
|
||||||
@@ -57,8 +58,8 @@ public class ShapeDetectionNPC : NPCController
|
|||||||
{
|
{
|
||||||
state = 1;
|
state = 1;
|
||||||
await CallPlayer();
|
await CallPlayer();
|
||||||
await Task.Delay(2500);
|
await Task.Delay(2000);
|
||||||
questMarker.MoveTo(radio.transform);
|
questMarker.MoveTo(radio.transform, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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,9 +135,9 @@ 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, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
string encodedTexture = Convert.ToBase64String(GeneratedTexture.EncodeToJPG());
|
string encodedTexture = Convert.ToBase64String(GeneratedTexture.EncodeToJPG());
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ public class QuestMarker : MonoBehaviour
|
|||||||
public Transform movingPart;
|
public Transform movingPart;
|
||||||
public float amplitude = 0.1f; // How far up/down it moves
|
public float amplitude = 0.1f; // How far up/down it moves
|
||||||
public float frequency = 1.5f; // Speed of oscillation
|
public float frequency = 1.5f; // Speed of oscillation
|
||||||
public float heightAboveTarget = 1f;
|
public float heightAboveTarget = 0.75f;
|
||||||
|
|
||||||
private Vector3 startPos;
|
private Vector3 startPos;
|
||||||
private Transform playerTransform;
|
private Transform playerTransform;
|
||||||
|
private Transform hoverAboveTransform;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
@@ -31,6 +32,13 @@ public class QuestMarker : MonoBehaviour
|
|||||||
Vector3 lookTargetPos = new Vector3(playerTransform.position.x, transform.position.y, playerTransform.position.z);
|
Vector3 lookTargetPos = new Vector3(playerTransform.position.x, transform.position.y, playerTransform.position.z);
|
||||||
transform.LookAt(lookTargetPos);
|
transform.LookAt(lookTargetPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hoverAboveTransform != null)
|
||||||
|
{
|
||||||
|
Debug.Log("pos before floating: " + transform.position);
|
||||||
|
transform.position = hoverAboveTransform.position + new Vector3(0f, heightAboveTarget, 0f);
|
||||||
|
Debug.Log("pos after floating: " + transform.position);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTriggerEnter(Collider other)
|
private void OnTriggerEnter(Collider other)
|
||||||
@@ -49,8 +57,15 @@ public class QuestMarker : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveTo(Transform target)
|
public void MoveTo(Transform target, bool attach = false)
|
||||||
{
|
{
|
||||||
transform.position = target.position + new Vector3(0, heightAboveTarget, 0);
|
transform.position = target.position + new Vector3(0, heightAboveTarget, 0);
|
||||||
|
if (attach)
|
||||||
|
{
|
||||||
|
hoverAboveTransform = target;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
hoverAboveTransform = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user