forked from cgvr/DeltaVR
professor says good job after first config done
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -26,8 +25,9 @@ public class ShapeDetectionNPC : NPCController
|
||||
// 3 - player spoke into the radio
|
||||
// 4 - player pressed enter on keyboard
|
||||
// 5 - player inserted picture into printer
|
||||
// 6 - shape scanner completed
|
||||
// 7 - moving away
|
||||
// 6 - player completed first shape scanner config
|
||||
// 7 - shape scanner completed
|
||||
// 8 - moving away
|
||||
private int state;
|
||||
private float lastPlayerApproachTime;
|
||||
|
||||
@@ -43,7 +43,8 @@ public class ShapeDetectionNPC : NPCController
|
||||
radio.OnPlayerFinishedSpeaking += OnPlayerSpokeIntoRadio;
|
||||
printerInsertionHole.OnPlayerInsertedPrintable += OnPlayerInitiatedPrinting;
|
||||
computerPrinter.OnImagePrinted += OnPlayerPrintedImage;
|
||||
shapeScanner.OnShapeScannerCompleted += OnShapeScannerCompleted;
|
||||
shapeScanner.OnConfigCompleted += OnPlayerCompletedFirstConfiguration;
|
||||
shapeScanner.OnAllCompleted += OnShapeScannerCompleted;
|
||||
}
|
||||
|
||||
protected async override void OnPlayerApproach()
|
||||
@@ -132,10 +133,22 @@ public class ShapeDetectionNPC : NPCController
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayerCompletedFirstConfiguration()
|
||||
{
|
||||
if (state == 5)
|
||||
{
|
||||
SpeakVoiceLine(6, radio.gameObject, radioAmount);
|
||||
state = 6;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnShapeScannerCompleted()
|
||||
{
|
||||
state = 6;
|
||||
questMarker.MoveTo(questMarkerPoint);
|
||||
if (state == 6)
|
||||
{
|
||||
state = 7;
|
||||
questMarker.MoveTo(questMarkerPoint);
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveToNextPoint(int pointIndex)
|
||||
@@ -153,9 +166,9 @@ public class ShapeDetectionNPC : NPCController
|
||||
|
||||
public async void OnPlayerEnteredRoom()
|
||||
{
|
||||
if (state == 6)
|
||||
if (state == 7)
|
||||
{
|
||||
state = 7;
|
||||
state = 8;
|
||||
staticRadio.SetActive(false);
|
||||
questMarker.gameObject.SetActive(false);
|
||||
await Task.Delay(2500);
|
||||
|
||||
@@ -35,11 +35,13 @@ public class ShapeScannerConfiguration
|
||||
|
||||
public class ShapeScanner : MonoBehaviour
|
||||
{
|
||||
public delegate void OnShapeScannerCompletedDelegate();
|
||||
public event OnShapeScannerCompletedDelegate OnShapeScannerCompleted;
|
||||
public delegate void OnConfigCompletedDelegate();
|
||||
public event OnConfigCompletedDelegate OnConfigCompleted;
|
||||
public delegate void OnAllCompletedDelegate();
|
||||
public event OnAllCompletedDelegate OnAllCompleted;
|
||||
|
||||
[Header("Static References")]
|
||||
public List<ShapeScannerConfiguration> configurations = new List<ShapeScannerConfiguration>();
|
||||
public List<ShapeScannerConfiguration> configurations = new();
|
||||
public ShapeScannerRay rayPrefab;
|
||||
public Transform raySpawnCorner1;
|
||||
public Transform raySpawnCorner2;
|
||||
@@ -163,6 +165,8 @@ public class ShapeScanner : MonoBehaviour
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ShapeScannerSuccess, gameObject);
|
||||
if (!particles.isPlaying) particles.Play();
|
||||
particles.Emit(100);
|
||||
|
||||
OnConfigCompleted?.Invoke();
|
||||
}
|
||||
|
||||
private float CalculateCorrectPercentage()
|
||||
@@ -235,6 +239,6 @@ public class ShapeScanner : MonoBehaviour
|
||||
// Create line renderer from shape scanner to door card reader
|
||||
lineRenderer.enabled = true;
|
||||
|
||||
OnShapeScannerCompleted?.Invoke();
|
||||
OnAllCompleted?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user