Implement TargetingPolicy, Cover can only target other allies

This commit is contained in:
henriquenakashima 2020-09-19 16:02:38 -04:00
parent 611601934d
commit 3e0004d4cb
21 changed files with 151 additions and 26 deletions

View file

@ -27,8 +27,6 @@ public class BattleController : MonoBehaviour
private int energy;
void Awake() {
this.heroDeck = new HeroDeck(cardIds);
heroes = new BattleHero[3];
heroSprites = new GameObject[3];
heroUIs = new HeroInfoUI[3];
@ -69,12 +67,25 @@ public class BattleController : MonoBehaviour
monsterUIs[i].Init(monsterSprites[i], monsters[i]);
}
BattleParticipant[] cardOwners = new BattleParticipant[this.cardIds.Length];
for (int i = 0; i < this.cardIds.Length; i++) {
cardOwners[i] = FindHeroByClass(CardDatabase.GetHeroIdOfCard(this.cardIds[i]));
}
this.heroDeck = new HeroDeck(this.cardIds, cardOwners);
this.battlePlayerControls.Init(this.heroDeck);
this.battlePlayerControls.OnCardUsed += this.NotifyCardUsed;
this.battlePlayerControls.OnTurnPassed += this.NotifyTurnPassed;
this.heroDeck.OnHandPileChanged += this.battlePlayerControls.NotifyHandPileChanged;
}
private BattleParticipant FindHeroByClass(HeroId heroId) {
foreach (BattleHero battleHero in this.heroes) {
if (battleHero.GetId() == heroId) return battleHero;
}
return null;
}
// Start is called before the first frame update
void Start()
{