From 68fe5357d20091fabd348c0c196ed15e317656c5 Mon Sep 17 00:00:00 2001 From: henrisel Date: Sat, 7 Mar 2026 13:46:26 +0200 Subject: [PATCH] professor walks away after having been saved --- .../_PROJECT/Fonts/Quantico-Regular SDF.asset | 4 +-- .../_PROJECT/Scenes/DeltaBuilding_base.unity | 4 +-- .../ModeGeneration/NPCs/ShapeDetectionNPC.cs | 28 +++++++++++++++++++ .../ShapeDetection/NPCFinalTriggerArea.cs | 28 +++++++++++++++++++ .../NPCFinalTriggerArea.cs.meta | 11 ++++++++ .../ShapeDetection/Printer3DInputHole.cs | 2 +- 6 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/NPCFinalTriggerArea.cs create mode 100644 Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/NPCFinalTriggerArea.cs.meta diff --git a/Assets/_PROJECT/Fonts/Quantico-Regular SDF.asset b/Assets/_PROJECT/Fonts/Quantico-Regular SDF.asset index 5a50fc9e..2eaf7f6d 100644 --- a/Assets/_PROJECT/Fonts/Quantico-Regular SDF.asset +++ b/Assets/_PROJECT/Fonts/Quantico-Regular SDF.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6608b8874526c797a72debcaaaab3267c64a65b06718c4b82bfd1ff397b9389d -size 2133558 +oid sha256:db8d934f0d4f859a353eb3fdc40d5c7150e599415f7ac3fdf3db61a30ee3ea42 +size 2137678 diff --git a/Assets/_PROJECT/Scenes/DeltaBuilding_base.unity b/Assets/_PROJECT/Scenes/DeltaBuilding_base.unity index 7f61231a..776f33d2 100644 --- a/Assets/_PROJECT/Scenes/DeltaBuilding_base.unity +++ b/Assets/_PROJECT/Scenes/DeltaBuilding_base.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4cee340c52a20f49412ed5a840373b36cf9cbe02fb3930378e01b06f4f283195 -size 68641651 +oid sha256:1767cceb3d0a2ebf27951a1df5f3185d2703201077fddcc714b7622cf2781ae7 +size 68653347 diff --git a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/ShapeDetectionNPC.cs b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/ShapeDetectionNPC.cs index 3f35f104..6221cd79 100644 --- a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/ShapeDetectionNPC.cs +++ b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/ShapeDetectionNPC.cs @@ -1,3 +1,4 @@ +using DG.Tweening; using System; using System.Threading.Tasks; using UnityEngine; @@ -13,6 +14,8 @@ public class ShapeDetectionNPC : NPCController public ShapeScanner shapeScanner; public Transform questMarkerPoint; public float radioAmount = 1f; + public Transform[] movementPath; + public float moveSpeedPerSecond = 2f; // states: @@ -22,6 +25,8 @@ 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 private int state; private float lastPlayerApproachTime; @@ -128,6 +133,29 @@ public class ShapeDetectionNPC : NPCController private void OnShapeScannerCompleted() { + state = 6; questMarker.MoveTo(questMarkerPoint); } + + private void MoveToNextPoint(int pointIndex) + { + Transform nextPoint = movementPath[pointIndex]; + float moveDuration = (nextPoint.position - transform.position).magnitude / moveSpeedPerSecond; + transform.DOMove(nextPoint.position, moveDuration).SetEase(Ease.Linear).OnComplete(() => + { + if (pointIndex < movementPath.Length - 1) + { + MoveToNextPoint(pointIndex + 1); + } + }); + } + + public void OnPlayerEnteredRoom() + { + if (state == 6) + { + questMarker.gameObject.SetActive(false); + MoveToNextPoint(0); + } + } } diff --git a/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/NPCFinalTriggerArea.cs b/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/NPCFinalTriggerArea.cs new file mode 100644 index 00000000..f57aba0a --- /dev/null +++ b/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/NPCFinalTriggerArea.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class NPCFinalTriggerArea : MonoBehaviour +{ + public ShapeDetectionNPC npc; + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + private void OnTriggerEnter(Collider other) + { + if (other.gameObject.tag == "Player Head") + { + npc.OnPlayerEnteredRoom(); + } + } +} diff --git a/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/NPCFinalTriggerArea.cs.meta b/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/NPCFinalTriggerArea.cs.meta new file mode 100644 index 00000000..cd62326a --- /dev/null +++ b/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/NPCFinalTriggerArea.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a356edc14b3aeb48b95081f0d876053 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/Printer3DInputHole.cs b/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/Printer3DInputHole.cs index 7cc006e4..388957cc 100644 --- a/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/Printer3DInputHole.cs +++ b/Assets/_PROJECT/Scripts/ModeGeneration/ShapeDetection/Printer3DInputHole.cs @@ -40,7 +40,6 @@ public class Printer3DInputHole : MonoBehaviour { ReleaseFromPlayer(printable); InsertPrintable(printable); - OnPlayerInsertedPrintable?.Invoke(); } } } @@ -82,6 +81,7 @@ public class Printer3DInputHole : MonoBehaviour { printer.PrintObject(printable.GetTexture()); Destroy(printable.gameObject); + OnPlayerInsertedPrintable?.Invoke(); }); } }