void SetMentorImage(int index) { if (index < dialogo.mentorMoods.Length) { MentorMood mentorMood = dialogo.mentorMoods[index]; mentorImage.sprite = allMentorsData. MentorByName(dialogo.mentor). SpriteMoodByName(mentorMood); } else { throw new System.IndexOutOfRangeException("Index out of bounds:" + index.ToString()); } }
public Sprite SpriteMoodByName(MentorMood name) { switch (name) { case MentorMood.HAPPY: return(happy); case MentorMood.ANGRY: return(angry); case MentorMood.NORMAL: return(normal); case MentorMood.SAD: return(sad); default: throw new System.ArgumentException("Value does not exists in MentorName", name.ToString()); } }