实现一个日记系统,将当前note/indexed条笔记存储到一个日记数组中
Implementing a diary system to store the current note/indexed note to a diary array
我正在尝试使用 AddNotesToDiary 函数将当前索引注释 instantiate/move/add 添加到日记数组中。当移动到日记数组时,索引的笔记应该从笔记数组中删除。我有想法,虽然我不知道前进的方向。
//list of Notes
public string[] notes;
public int index; //which current note available
public string currentNote;
//Collected Notes or Diary
public string[] Diary;
private void Start()
{
//current note in the index
currentNote = notes[index];
}
private void Update()
{
//current note in the index
currentNote = notes[index];
}
private void AddNotesToDiary()
{
//how to instantiate/move/add the note[index] to the Diary[]
}
您可以将 string[]
替换为 List<string>
。这将使您可以在笔记和日记中添加和删除:
notes.Remove(currentNote);
Diary.Add(currentNote);
我正在尝试使用 AddNotesToDiary 函数将当前索引注释 instantiate/move/add 添加到日记数组中。当移动到日记数组时,索引的笔记应该从笔记数组中删除。我有想法,虽然我不知道前进的方向。
//list of Notes
public string[] notes;
public int index; //which current note available
public string currentNote;
//Collected Notes or Diary
public string[] Diary;
private void Start()
{
//current note in the index
currentNote = notes[index];
}
private void Update()
{
//current note in the index
currentNote = notes[index];
}
private void AddNotesToDiary()
{
//how to instantiate/move/add the note[index] to the Diary[]
}
您可以将 string[]
替换为 List<string>
。这将使您可以在笔记和日记中添加和删除:
notes.Remove(currentNote);
Diary.Add(currentNote);