public static void loadNPCWithSkin(GameObject npc, string skinName, NPCSkinType skinType) { string skinLoc = skinPrefix + skinName; GameObject skin = (GameObject)Instantiate (Resources.Load (skinLoc)); npc.GetComponent<SpriteRenderer> ().sprite = skin.GetComponent<SpriteRenderer> ().sprite; npc.GetComponent<Animator> ().runtimeAnimatorController = skin.GetComponent<Animator> ().runtimeAnimatorController; npc.GetComponent<AIController>().SkinType = skinType; Destroy (skin); }
private static void AddNPCType(IDictionary<NPCSkinType, NPCData> data, NPCSkinType skinType, NPCData npcData) { data[skinType] = npcData; npcData.SkinType = skinType; }