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,13 +52,10 @@ 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>();
/*StampDocument stampDoc = paperObject.GetComponent<StampDocument>();*/
if (stampDoc != null)
{
@ -95,7 +92,6 @@ public class PaperSocket : MonoBehaviour
}
}
}
}
/// <summary>
/// Removed logic