Home > Enterprise >  Implementing a diary system to store the current note/indexed note to a diary array
Implementing a diary system to store the current note/indexed note to a diary array

Time:05-31

I'm trying to instantiate/move/add the current index note to the diary array using the AddNotesToDiary Function. The indexed note should be removed from the notes array when moved to the diary array. I have the idea, though i can't figure out the way forward.

//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[]

}

CodePudding user response:

you could replace the string[] with List<string>. this would let you add and remove from the notes and diary:

notes.Remove(currentNote);
Diary.Add(currentNote);
  • Related