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

@ -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;}
}