using System.Collections; using System.Collections.Generic; using UnityEngine; public enum MCardId { Eagerness, QuickSwiftDeath, VampireFangs, Whirlwind, BlanketOfDarkness, Echolocation, GolemFist, GraniteDefense, SelfRepair, GolemCharge, GolemBerserk, } public class MonsterCardDatabase : CardDatabase { private System.Type GetCardClass(MCardId id) { switch (id) { case MCardId.Eagerness: return typeof(EagernessMCard); case MCardId.QuickSwiftDeath: return typeof(QuickSwiftDeathMCard); case MCardId.VampireFangs: return typeof(VampireFangsMCard); case MCardId.Whirlwind: return typeof(WhirlwindMCard); case MCardId.Echolocation: return typeof(EcholocationMCard); case MCardId.GolemFist: return typeof(GolemFistMCard); case MCardId.GraniteDefense: return typeof(GraniteDefenseMCard); case MCardId.GolemCharge: return typeof(GolemChargeMCard); case MCardId.GolemBerserk: return typeof(GolemBerserkMCard); default: throw new System.ArgumentException("MCardId unknown", "id"); } } public override MonsterCard CreateCard(int id, BattleParticipant owner) { MCardId monsterCardId = (MCardId) id; System.Type cardClass = GetCardClass(monsterCardId); return (MonsterCard) System.Activator.CreateInstance(cardClass, owner); } }