Implement insight level

This commit is contained in:
henriquenakashima 2020-09-20 14:37:51 -04:00
parent ca16846f2a
commit 537538a6ca
4 changed files with 22 additions and 9 deletions

View file

@ -31,9 +31,9 @@ public class BattlePlayerControls : MonoBehaviour
this.monsterDeck = monsterDeck;
this.playArea = playArea;
this.heroHandControls = new HandControls<HeroCard>(this.uiCanvas, this.cardPrefab, HandControlsPosition.Bottom);
this.heroHandControls = new HandControls<HeroCard>(this.uiCanvas, this.cardPrefab, HandControlsPosition.Bottom, int.MaxValue);
this.heroHandControls.OnCardClicked += OnHeroCardClicked;
this.monsterHandControls = new HandControls<MonsterCard>(this.uiCanvas, this.cardPrefab, HandControlsPosition.Top);
this.monsterHandControls = new HandControls<MonsterCard>(this.uiCanvas, this.cardPrefab, HandControlsPosition.Top, 1);
this.monsterHandControls.OnCardClicked += OnMonsterCardClicked;
this.cardsInPlayUIs = new Dictionary<BaseCard, GameObject>();
}
@ -51,10 +51,6 @@ public class BattlePlayerControls : MonoBehaviour
}
private void SetMonsterHand(List<MonsterCard> hand) {
// TODO
}
private void OnHeroCardClicked(HeroCard card) {
if (this.singleTargeting == null) {
if (this.battleController.CanUseHeroCard(card)) {

View file

@ -6,7 +6,7 @@ public class VampireFangsMCard : MonsterCard
{
public VampireFangsMCard(BattleParticipant owner)
: base(owner, MCardId.VampireFangs, "VampireFangs", 2, CardType.Attack,
"Steals 2 HP from target.") {
"Steals 2 HP from target. Target: highest HP hero.") {
}
public override IEnumerator Use(IBattleEffectApplier effectApplier, MonsterViewpoint monsterViewpoint) {

View file

@ -19,11 +19,14 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
private HandControlsPosition position;
private List<GameObject> cardsInHandUIs;
private int insightLevel;
public HandControls(GameObject uiCanvas, GameObject cardPrefab, HandControlsPosition position) {
public HandControls(GameObject uiCanvas, GameObject cardPrefab, HandControlsPosition position,
int insightLevel) {
this.uiCanvas = uiCanvas;
this.cardPrefab = cardPrefab;
this.position = position;
this.insightLevel = insightLevel;
}
public void SetHand(List<BaseCardT> hand) {
@ -39,7 +42,12 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
GameObject cardUI = GameObject.Instantiate(this.cardPrefab, this.uiCanvas.transform);
this.cardsInHandUIs.Add(cardUI);
cardUI.transform.position = CalculateHandCardPosition(i, hand.Count);
cardUI.GetComponent<CardUI>().Init(card);
CardUI cardUIScript = cardUI.GetComponent<CardUI>();
if (i < this.insightLevel) {
cardUIScript.Init(card);
} else {
cardUIScript.InitHidden();
}
int cardIndex = i;
cardUI.GetComponent<Button>().onClick.AddListener(delegate {OnCardClicked(card);});
}
@ -56,4 +64,6 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
return new Vector3(x, y, 0);
}
public int InsightLevel {get => this.insightLevel; set => this.insightLevel = value;}
}

View file

@ -18,6 +18,13 @@ public class CardUI : MonoBehaviour
this.effectText.text = card.GetEffectText();
}
public void InitHidden() {
this.nameText.text = "????";
this.typeText.text = "????";
this.costText.text = "????";
this.effectText.text = "????";
}
// Start is called before the first frame update
void Start()
{