Only alive participants can act

This commit is contained in:
henriquenakashima 2020-09-20 16:02:13 -04:00
parent a5a96edf25
commit adc84f9aba
5 changed files with 44 additions and 8 deletions

View file

@ -62,6 +62,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
BattleParticipantSprite bps = heroSprites[i].AddComponent<BattleParticipantSprite>();
bps.Init(battlePlayerControls, heroes[i]);
bps.OnSpriteClicked += battlePlayerControls.NotifyParticipantSpriteClicked;
heroes[i].OnDeath += bps.NotifyDeath;
heroUIs[i] = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI));
heroUIs[i].Init(heroSprites[i], heroes[i]);
@ -82,6 +83,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
BattleParticipantSprite bps = monsterSprites[i].AddComponent<BattleParticipantSprite>();
bps.Init(battlePlayerControls, monsters[i]);
bps.OnSpriteClicked += battlePlayerControls.NotifyParticipantSpriteClicked;
monsters[i].OnDeath += bps.NotifyDeath;
monsterUIs[i] = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI));
monsterUIs[i].Init(monsterSprites[i], monsters[i]);
@ -237,11 +239,11 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
}
public bool CanUseHeroCard(HeroCard card) {
return this.heroTurn && this.heroEnergy.CanPayForCard(card);
return this.heroTurn && card.Owner.IsAlive() && this.heroEnergy.CanPayForCard(card);
}
public bool CanUseMonsterCard(MonsterCard card) {
return !this.heroTurn && this.monsterEnergy.CanPayForCard(card);
return !this.heroTurn && card.Owner.IsAlive() && this.monsterEnergy.CanPayForCard(card);
}
public BattleDeck<HeroCard> GetHeroDeck() {