public Sprite GetSprite(string mood, string phonetic) { LipsyncPrestonBlairMouth mouth = mouths.Find(m => m.mood == mood); if (mouth == null) { Debug.LogWarning("Could not found mouth for " + mood + " trying to default to first mouth"); if (mouths.Count > 0) { mouth = mouths[0]; } else { Debug.LogError("No mouths assigned!"); } } Sprite sprite = mouth.rest; switch (phonetic) { case "AI": sprite = mouth.AI; break; case "E": sprite = mouth.E; break; case "etc": sprite = mouth.etc; break; case "FV": sprite = mouth.FV; break; case "L": sprite = mouth.L; break; case "MBP": sprite = mouth.MBP; break; case "O": sprite = mouth.O; break; case "U": sprite = mouth.U; break; case "WQ": sprite = mouth.WQ; break; } return(sprite); }
public static bool CreateSet(LipsyncMouthSetCreatorSettings.ImportMouth[] importMouths, int[] spriteAssignment, out LipsyncMouthSet set) { set = ScriptableObject.CreateInstance <LipsyncMouthSet>(); for (int i = 0; i < importMouths.Length; i++) { LipsyncPrestonBlairMouth mouth = new LipsyncPrestonBlairMouth(); mouth.mood = importMouths[i].mood; Sprite[] spriteSet = GetSpriteSet(importMouths[i].spritesheet); for (int s = 0; s < spriteAssignment.Length; s++) { try { mouth[s] = spriteSet[spriteAssignment[s]]; } catch (IndexOutOfRangeException e) { Debug.Log("sprite assignment failed " + importMouths[i].spritesheet); } } set.mouths.Add(mouth); } return(true); }
public bool HasMood(string mood) { LipsyncPrestonBlairMouth mouth = mouths.Find(m => m.mood == mood); return(mouth == null ? false : true); }