Convert HeroDeck into BattleDeck<HeroCard>

This commit is contained in:
henriquenakashima 2020-09-20 12:17:04 -04:00
parent c2e8b526b6
commit de072a80f7
8 changed files with 93 additions and 67 deletions

View file

@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum CardId {
CrashingPunch,
Cover,
LightningStrike,
Scarring,
Thunderstorm,
}
public class HeroCardDatabase : CardDatabase<HeroCard>
{
private static Dictionary<CardId, HeroId> CARD_TO_HERO = new Dictionary<CardId, HeroId>() {
{CardId.CrashingPunch, HeroId.Brute},
{CardId.Cover, HeroId.Brute},
{CardId.LightningStrike, HeroId.Shaman},
{CardId.Scarring, HeroId.Brute},
{CardId.Thunderstorm, HeroId.Shaman},
};
public override HeroCard CreateCard(int id, BattleParticipant owner) {
CardId heroCardId = (CardId) id;
switch (heroCardId)
{
case CardId.CrashingPunch:
return new CardCrashingPunch(owner);
case CardId.Cover:
return new CardCover(owner);
case CardId.LightningStrike:
return new CardLightningStrike(owner);
case CardId.Scarring:
return new CardScarring(owner);
case CardId.Thunderstorm:
return new CardThunderstorm(owner);
default:
throw new System.ArgumentException("CardId unknown", "id");
}
}
public static HeroId GetHeroIdOfCard(CardId id) {
return CARD_TO_HERO[id];
}
}