public GameObject Instantiate(BattleMapMonsterType monsterType, int sortingOrder) { string str = monsterType.ToString().ToLower().Replace("_", ""); GameObject prefab = PrefabUtils.GetPrefab(this, str); GameObject go = Instantiate(prefab) as GameObject; go.GetComponent <SpriteRenderer>().sortingOrder = sortingOrder; return(go); }
/// <summary> /// 顔のスプライトを取得 /// </summary> /// <param name="monsterType"></param> /// <returns></returns> private Sprite GetFaceImageSprite(BattleMapMonsterType monsterType) { // キャッシュから取得 bool exists = monsterFaceSpriteDic.ContainsKey(monsterType); if (exists) { return(monsterFaceSpriteDic[monsterType]); } // パスを作成 string typeStr = monsterType.ToString().ToLower(); string imagePath = IMAGE_FACE_RESOURCE_PREFIX + typeStr; // スプライトを取得 return(Resources.Load <Sprite>(imagePath)); }