forked from cgvr/DeltaVR
NPCs move quest marker around to next objectives
This commit is contained in:
@@ -7,11 +7,13 @@ using System.Threading.Tasks;
|
||||
public class ArcheryRangeNPC : NPCController
|
||||
{
|
||||
[Header("Archery Range Config")]
|
||||
public QuestMarker questMarker;
|
||||
public MicrophoneStand microphoneStand;
|
||||
public PushableButton imageGenerationButton;
|
||||
public PushableButton modelGenerationButton;
|
||||
public Image imageDisplay;
|
||||
public ModelDisplay modelDisplay;
|
||||
public Transform startTarget;
|
||||
|
||||
private Texture2D GeneratedTexture;
|
||||
private EventInstance printingSound;
|
||||
@@ -44,11 +46,14 @@ public class ArcheryRangeNPC : NPCController
|
||||
{
|
||||
if (state == 0)
|
||||
{
|
||||
questMarker.gameObject.SetActive(false);
|
||||
SpeakVoiceLine(0);
|
||||
await Task.Delay(2000);
|
||||
SpeakVoiceLine(1);
|
||||
await Task.Delay(6500);
|
||||
SpeakVoiceLine(2);
|
||||
questMarker.gameObject.SetActive(true);
|
||||
questMarker.MoveTo(microphoneStand.transform);
|
||||
await Task.Delay(3000);
|
||||
|
||||
state = 1;
|
||||
@@ -65,6 +70,7 @@ public class ArcheryRangeNPC : NPCController
|
||||
if (state == 1)
|
||||
{
|
||||
SpeakVoiceLine(3);
|
||||
questMarker.MoveTo(imageGenerationButton.transform);
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
@@ -87,6 +93,7 @@ public class ArcheryRangeNPC : NPCController
|
||||
{
|
||||
modelGenerationButton.Deactivate();
|
||||
SpeakVoiceLine(4);
|
||||
questMarker.MoveTo(modelGenerationButton.transform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +116,7 @@ public class ArcheryRangeNPC : NPCController
|
||||
if (state == 4)
|
||||
{
|
||||
SpeakVoiceLine(5);
|
||||
questMarker.MoveTo(startTarget);
|
||||
state = 5;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,14 @@ using UnityEngine.UI;
|
||||
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 Texture2D GeneratedTexture { get; private set; }
|
||||
public Image imageDisplay;
|
||||
public ShapeScanner shapeScanner;
|
||||
|
||||
public GameObject GeneratedModel { get; private set; }
|
||||
public Transform modelSpawnPoint;
|
||||
@@ -55,6 +57,8 @@ public class ShapeDetectionNPC : NPCController
|
||||
{
|
||||
state = 1;
|
||||
await CallPlayer();
|
||||
await Task.Delay(2500);
|
||||
questMarker.MoveTo(radio.transform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,12 +86,14 @@ public class ShapeDetectionNPC : NPCController
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayerPickedUpRadio()
|
||||
private async void OnPlayerPickedUpRadio()
|
||||
{
|
||||
if (state == 1)
|
||||
{
|
||||
SpeakVoiceLine(2);
|
||||
state = 2;
|
||||
await Task.Delay(5000);
|
||||
questMarker.MoveTo(microphoneStand.transform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +104,7 @@ public class ShapeDetectionNPC : NPCController
|
||||
{
|
||||
SpeakVoiceLine(3);
|
||||
state = 3;
|
||||
questMarker.MoveTo(imageGenerationButton.transform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +121,7 @@ public class ShapeDetectionNPC : NPCController
|
||||
{
|
||||
SpeakVoiceLine(4);
|
||||
state = 4;
|
||||
questMarker.MoveTo(modelGenerationButton.transform);
|
||||
modelGenerationButton.Deactivate();
|
||||
}
|
||||
}
|
||||
@@ -124,6 +132,7 @@ public class ShapeDetectionNPC : NPCController
|
||||
{
|
||||
SpeakVoiceLine(5);
|
||||
state = 5;
|
||||
questMarker.MoveTo(shapeScanner.transform);
|
||||
}
|
||||
|
||||
string encodedTexture = Convert.ToBase64String(GeneratedTexture.EncodeToJPG());
|
||||
|
||||
@@ -7,6 +7,7 @@ public class QuestMarker : MonoBehaviour
|
||||
public Transform movingPart;
|
||||
public float amplitude = 0.1f; // How far up/down it moves
|
||||
public float frequency = 1.5f; // Speed of oscillation
|
||||
public float heightAboveTarget = 1f;
|
||||
|
||||
private Vector3 startPos;
|
||||
private Transform playerTransform;
|
||||
@@ -47,4 +48,9 @@ public class QuestMarker : MonoBehaviour
|
||||
playerTransform = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveTo(Transform target)
|
||||
{
|
||||
transform.position = target.position + new Vector3(0, heightAboveTarget, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user