Show playable cards in enemy hand

This commit is contained in:
henriquenakashima 2020-09-30 19:33:53 -04:00
parent d513657396
commit b654419966
5 changed files with 22 additions and 7 deletions

View file

@ -136,7 +136,8 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
this.battlePlayerControls.Init(
this.heroDeck, this.monsterDeck, this.playArea, this.insightLevel,
this.heroHandPlayability, this.uiCanvas.transform.localScale.x);
this.heroHandPlayability, this.monsterHandPlayability,
this.uiCanvas.transform.localScale.x);
this.insightLevel.OnChanged += this.battlePlayerControls.NotifyInsightLevelChanged;
}
@ -155,9 +156,13 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
{
StartCoroutine(RunBattleRounds());
new GameObject("CheatBattle").AddComponent<CheatBattle>().OnWinCode += delegate {
CheatBattle cheat = new GameObject("CheatBattle").AddComponent<CheatBattle>();
cheat.OnWinCode += delegate {
BattleResult.FinishBattle(new BattleResult(true));
};
cheat.OnInsightCode += delegate {
this.insightLevel.Modify(+5);
};
}
// Update is called once per frame

View file

@ -25,7 +25,8 @@ public class BattlePlayerControls : MonoBehaviour
public void Init(
BattleDeck<HeroCard> heroDeck, BattleDeck<MonsterCard> monsterDeck, PlayArea playArea,
InsightLevel insightLevel, HandPlayability<HeroCard> heroHandPlayability, float scale) {
InsightLevel insightLevel, HandPlayability<HeroCard> heroHandPlayability,
HandPlayability<MonsterCard> monsterHandPlayability, float scale) {
this.heroDeck = heroDeck;
this.monsterDeck = monsterDeck;
this.playArea = playArea;
@ -38,7 +39,7 @@ public class BattlePlayerControls : MonoBehaviour
this.heroHandControls.OnCardClicked += OnHeroCardClicked;
this.monsterHandControls = new HandControls<MonsterCard>(
monsterDeck, this.uiCanvas, this.cardPrefab, HandControlsPosition.Top,
TeamChoice.Monsters, 1, null, this.scale);
TeamChoice.Monsters, 1, monsterHandPlayability, this.scale);
this.monsterHandControls.OnCardClicked += OnMonsterCardClicked;
this.cardsInPlayUIs = new Dictionary<BaseCard, GameObject>();

View file

@ -77,6 +77,7 @@ public class CheatBattle: MonoBehaviour
public delegate void CheatAction();
public event CheatAction OnWinCode;
public event CheatAction OnInsightCode;
private string lastCommands = "";
@ -89,6 +90,8 @@ public class CheatBattle: MonoBehaviour
if (this.lastCommands.EndsWith("win")) {
this.OnWinCode();
} else if (this.lastCommands.EndsWith("insight")) {
this.OnInsightCode();
}
}
}

View file

@ -61,7 +61,7 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
get => this.insightLevel;
set {
this.insightLevel = value;
RenderHand();
UpdateState();
}
}

View file

@ -11,7 +11,10 @@ public class CardUI : MonoBehaviour
public Image artImage;
public Text effectText;
private bool hidden;
public void Init(BaseCard card) {
this.hidden = false;
this.nameText.text = card.GetDisplayName();
this.typeText.text = card.GetDisplayType();
if (card.Type != CardType.Emotion) {
@ -25,6 +28,7 @@ public class CardUI : MonoBehaviour
}
public void InitHidden() {
this.hidden = true;
Color BROWN = new Color(0.14f, 0.09f, 0.04f);
this.nameText.text = "????";
this.typeText.text = "????";
@ -53,8 +57,10 @@ public class CardUI : MonoBehaviour
public bool Playable {
set {
this.GetComponent<Image>().color = value ? Color.white : Color.grey;
this.artImage.color = value ? Color.white : Color.grey;
if (!this.hidden) {
this.GetComponent<Image>().color = value ? Color.white : Color.grey;
this.artImage.color = value ? Color.white : Color.grey;
}
}
}
}