game: npcs can be more than one

This commit is contained in:
kookiekenobi 2025-02-18 01:09:31 +08:00
parent 7d1c308e34
commit 52d2a0c373
2 changed files with 30 additions and 34 deletions

View file

@ -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

View file

@ -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<StampDocument>(out StampDocument stampDoc))
{
if (paperName == "Spawnable_Doc")
/*StampDocument stampDoc = paperObject.GetComponent<StampDocument>();*/
if (stampDoc != null)
{
StampDocument stampDoc = paperObject.GetComponent<StampDocument>();
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<NpcMovementRework>().npcData.points;
}
else if (paperDepartment == "Wrong")
{
Backend.instance.User.customersHelpedWrongly += 1;
}*/
Destroy(paperObject);
GameManager.instance.currentNPC.GetComponent<NpcMovementRework>().EndDialogue();
GameManager.instance.currentNPC.GetComponent<NpcMovementRework>().Despawn();
GameManager.instance.currentNPC = null;
}
else
var paperDepartment = stampDoc.CheckFinalDepartment();
Debug.Log(paperDepartment);
/*if (paperDepartment == "Correct")
{
XRSocketInteractor socket = GetComponent<XRSocketInteractor>();
socket.interactionManager.SelectExit(socket, args.interactableObject);
Backend.instance.User.customersHelpedCorrectly += 1;
Backend.instance.User.score += GameManager.instance.currentNPC.GetComponent<NpcMovementRework>().npcData.points;
}
else if (paperDepartment == "Wrong")
{
Backend.instance.User.customersHelpedWrongly += 1;
}*/
Destroy(paperObject);
GameManager.instance.currentNPC.GetComponent<NpcMovementRework>().EndDialogue();
GameManager.instance.currentNPC.GetComponent<NpcMovementRework>().Despawn();
GameManager.instance.currentNPC = null;
}
else
{
XRSocketInteractor socket = GetComponent<XRSocketInteractor>();
socket.interactionManager.SelectExit(socket, args.interactableObject);
}
}
}