Initial import

This commit is contained in:
henriquenakashima 2020-09-17 22:52:50 -04:00
parent 71fb5e578f
commit 3cb9eb5031
69 changed files with 4197 additions and 0 deletions

View file

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum MonsterId {
Bat,
Golem,
}
public class MonsterDatabase
{
private static Dictionary<MonsterId, string> SPRITE_NAMES = new Dictionary<MonsterId, string> {
{MonsterId.Bat, "BatSprite"},
{MonsterId.Golem, "GolemSprite"},
};
public static BattleMonster createMonsterScript(MonsterId id) {
switch (id)
{
case MonsterId.Bat:
return new BatMonster();
case MonsterId.Golem:
return new GolemMonster();
default:
throw new System.ArgumentException("MonsterId unknown", "id");
}
}
public static GameObject createMonsterSprite(MonsterId id) {
GameObject spritePrefab = (GameObject) Resources.Load<GameObject>("MonsterImages/" + SPRITE_NAMES[id]);
if (spritePrefab == null) {
throw new System.ArgumentException("No sprite for MonsterId", "id");
}
return GameObject.Instantiate(spritePrefab);
}
}