//callback //for when actor is supposed to exit private void ExitListener(object sender, TextIntEventArgs e) { //finds the sigular actor we want to manipulate DialogueActor da = FindActor(e.name); //makes sure that the found actor isn't null if (da != null) { //get the game object of actor for faster access GameObject go = da.gameObject; //removes the actor from the list, doens't destroy them actors.Remove(da); //destroys the actor object da.MoveOffScreen(); } }
//call to end the dialogue private void EndDialogue() { //holding array length int length = actors.Count; for (int i = 0; i < length; i++) { //holds the DialogueActor object we want to use, easier access DialogueActor da = actors[0]; //removes actor from the array at index 0, since removing an element will reduce the number of remaining elements, 0 index will always have an element actors.RemoveAt(0); //destroys the actor object and moves it offscreen da.MoveOffScreen(); } //moves dialogue panel into place dialogueParent.DOLocalMoveY(-900, 0.1f); //no longer in the middle of dialogue inDialogue = false; }