Initial import
This commit is contained in:
parent
71fb5e578f
commit
3cb9eb5031
69 changed files with 4197 additions and 0 deletions
27
Assets/Battle/HeroDatabase.cs
Normal file
27
Assets/Battle/HeroDatabase.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue