40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using UnityEngine;
|
|
|
|
public class MemoryClueSlot : ClueSlotBase
|
|
{
|
|
private MemoryProcess memoryManager;
|
|
[HideInInspector]
|
|
public PunchTape punchTape;
|
|
|
|
protected override void Start()
|
|
{
|
|
base.Start(); // 初始化基类中的内容
|
|
memoryManager = FindObjectOfType<MemoryProcess>();
|
|
expectedClueType=ClueType.PunchTape;
|
|
}
|
|
|
|
// 重写基类的 OnClueInserted 方法,处理播放记忆的逻辑
|
|
protected override void OnClueInserted(Clue clue)
|
|
{
|
|
if (clue is PunchTape)
|
|
{
|
|
punchTape = clue as PunchTape;
|
|
PlayMemory(punchTape);
|
|
}
|
|
}
|
|
public override void ReleaseSlot()
|
|
{
|
|
base.ReleaseSlot();
|
|
punchTape = null; // 清除 PunchTape 引用
|
|
}
|
|
private void PlayMemory(PunchTape punchTape)
|
|
{
|
|
if (punchTape != null)
|
|
{
|
|
string memoryIndex = punchTape.MemoryIndex;
|
|
Debug.Log("播放记忆:" + memoryIndex);
|
|
StartCoroutine(memoryManager.SearchMemory(punchTape));
|
|
}
|
|
}
|
|
}
|