Exemplo n.º 1
0
 public Sprite GetSprite(Mood mood)
 {
     //to avoid weird index, we always want
     if (moodSprites.Length == Mood.GetValues(typeof(Mood)).Length)
     {
         if (moodSprites[(int)mood].sprite != null)
         {
             return(moodSprites[(int)mood].sprite);
         }
         else
         {
             throw new System.Exception("the sprite for this mood is null!");
         }
     }
     else
     {
         throw new System.Exception("MoodAndSprite array's length does not match the enum's length, indexing issue!");
     }
 }