27 lines
757 B
C#
27 lines
757 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public enum HeroId {
|
|
Alchemist,
|
|
Brute,
|
|
Shaman,
|
|
}
|
|
|
|
public class HeroDatabase
|
|
{
|
|
private static Dictionary<HeroId, string> SPRITE_NAMES = new Dictionary<HeroId, string> {
|
|
{HeroId.Alchemist, "AlchemistSprite"},
|
|
{HeroId.Brute, "BruteSprite"},
|
|
{HeroId.Shaman, "ShamanSprite"},
|
|
};
|
|
|
|
public static GameObject createHeroSprite(HeroId id) {
|
|
GameObject spritePrefab = (GameObject) Resources.Load<GameObject>("HeroImages/" + SPRITE_NAMES[id]);
|
|
if (spritePrefab == null) {
|
|
throw new System.ArgumentException("No sprite for HeroId", "id");
|
|
}
|
|
|
|
return GameObject.Instantiate(spritePrefab);
|
|
}
|
|
}
|