From 52d2a0c3733ed9484f234ab02c40cdfa733cc813 Mon Sep 17 00:00:00 2001 From: kookiekenobi Date: Tue, 18 Feb 2025 01:09:31 +0800 Subject: [PATCH] game: npcs can be more than one --- SSLR/Assets/Scenes/LiviPlayground.unity | 2 +- SSLR/Assets/Scripts/PaperSocket.cs | 62 ++++++++++++------------- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/SSLR/Assets/Scenes/LiviPlayground.unity b/SSLR/Assets/Scenes/LiviPlayground.unity index d0d8e7a..fc8d162 100644 --- a/SSLR/Assets/Scenes/LiviPlayground.unity +++ b/SSLR/Assets/Scenes/LiviPlayground.unity @@ -2237,7 +2237,7 @@ MonoBehaviour: m_fontSizeBase: 60.45 m_fontWeight: 400 m_enableAutoSizing: 1 - m_fontSizeMin: 40 + m_fontSizeMin: 20 m_fontSizeMax: 72 m_fontStyle: 0 m_HorizontalAlignment: 2 diff --git a/SSLR/Assets/Scripts/PaperSocket.cs b/SSLR/Assets/Scripts/PaperSocket.cs index e1a560c..00c3a26 100644 --- a/SSLR/Assets/Scripts/PaperSocket.cs +++ b/SSLR/Assets/Scripts/PaperSocket.cs @@ -52,46 +52,42 @@ public class PaperSocket : MonoBehaviour private void OnPaperAttached(SelectEnterEventArgs args) { GameObject paperObject = args.interactableObject.transform.gameObject; - string paperName = paperObject.name; - if (socketName == "Paper Socket_NPC" && paperName == "Spawnable_Doc") + if (paperObject.TryGetComponent(out StampDocument stampDoc)) { - if (paperName == "Spawnable_Doc") + /*StampDocument stampDoc = paperObject.GetComponent();*/ + + if (stampDoc != null) { - StampDocument stampDoc = paperObject.GetComponent(); - - if (stampDoc != null) + if (stampDoc.isStamped && stampDoc.isSigned) { - if (stampDoc.isStamped && stampDoc.isSigned) - { - Debug.Log("Checked Docs"); - PlayerDialogueInteraction.instance.takeDocumentsTick.SetActive(true); - PlayerDialogueInteraction.instance.giveDocumentsTick.SetActive(true); + Debug.Log("Checked Docs"); + PlayerDialogueInteraction.instance.takeDocumentsTick.SetActive(true); + PlayerDialogueInteraction.instance.giveDocumentsTick.SetActive(true); - var paperDepartment = stampDoc.CheckFinalDepartment(); - Debug.Log(paperDepartment); - /*if (paperDepartment == "Correct") - { - Backend.instance.User.customersHelpedCorrectly += 1; - Backend.instance.User.score += GameManager.instance.currentNPC.GetComponent().npcData.points; - } - else if (paperDepartment == "Wrong") - { - Backend.instance.User.customersHelpedWrongly += 1; - }*/ - - Destroy(paperObject); - - GameManager.instance.currentNPC.GetComponent().EndDialogue(); - - GameManager.instance.currentNPC.GetComponent().Despawn(); - GameManager.instance.currentNPC = null; - } - else + var paperDepartment = stampDoc.CheckFinalDepartment(); + Debug.Log(paperDepartment); + /*if (paperDepartment == "Correct") { - XRSocketInteractor socket = GetComponent(); - socket.interactionManager.SelectExit(socket, args.interactableObject); + Backend.instance.User.customersHelpedCorrectly += 1; + Backend.instance.User.score += GameManager.instance.currentNPC.GetComponent().npcData.points; } + else if (paperDepartment == "Wrong") + { + Backend.instance.User.customersHelpedWrongly += 1; + }*/ + + Destroy(paperObject); + + GameManager.instance.currentNPC.GetComponent().EndDialogue(); + + GameManager.instance.currentNPC.GetComponent().Despawn(); + GameManager.instance.currentNPC = null; + } + else + { + XRSocketInteractor socket = GetComponent(); + socket.interactionManager.SelectExit(socket, args.interactableObject); } } }