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

40 lines
1.1 KiB
C#

using System;
using UnityEngine;
[Serializable]
public class PunchTape : Clue
{
public string MemoryIndex { get; set; }
public bool used=false;
// 构造函数,初始化特有属性并传递给基类
public PunchTape(string category, string name, string memoryIndex)
: base(category, name)
{
MemoryIndex = memoryIndex;
ClueType = ClueType.PunchTape;
}
// 重写 Display 方法,实现 PunchTape 的展示逻辑
public override void Display(ClueItem clueItem)
{
if (clueItem == null)
{
Debug.LogWarning("ClueItem is null. Display aborted.");
return;
}
if (clueItem.clueImageUI!=null&&used)
{
clueItem.clueImageUI.color=Color.grey;
}
if(clueItem.stateText!=null&&used)
{
clueItem.gameObject.SetActive(true);
}
if (clueItem.categoryText != null) clueItem.categoryText.text = "分类:" + Category;
if (clueItem.nameText != null) clueItem.nameText.text = "名称:" + ClueName;
}
}