Files
aibis-dream/Assets/Scripts/Clue/MemoryClueSlot.cs
T

41 lines
1.1 KiB
C#

using System.Drawing;
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)
{
punchTape = clue as PunchTape;
coverClose.enabled=true;
coverOpen.enabled=false;
PlayMemory(punchTape);
FavoritesManager.Instance.RemoveClue(clue);
}
public override void ReleaseSlot()
{
base.ReleaseSlot(); // 保证基类的清理逻辑被执行
}
private void PlayMemory(PunchTape punchTape)
{
if (punchTape != null)
{
string memoryIndex = punchTape.MemoryIndex;
Debug.Log("播放记忆:" + memoryIndex);
StartCoroutine(memoryManager.SearchMemory(punchTape));
}
}
}