Create MonsterCard
This commit is contained in:
parent
169210efbe
commit
cce0b2891c
22 changed files with 203 additions and 27 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
|
@ -9,7 +10,7 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
public GameObject uiCanvas;
|
||||
public GameObject cardPrefab;
|
||||
|
||||
public delegate void CardUsedAction(BaseCard card);
|
||||
public delegate void CardUsedAction(HeroCard card);
|
||||
public event CardUsedAction OnCardUsed;
|
||||
public delegate void TurnPassedAction();
|
||||
public event TurnPassedAction OnTurnPassed;
|
||||
|
|
@ -39,7 +40,7 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
|
||||
}
|
||||
|
||||
private void SetHand(List<BaseCard> hand) {
|
||||
private void SetHand(List<HeroCard> hand) {
|
||||
if (this.cardsInHandUIs != null) {
|
||||
foreach (GameObject cardInHandUI in this.cardsInHandUIs) {
|
||||
Destroy(cardInHandUI);
|
||||
|
|
@ -48,7 +49,7 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
|
||||
this.cardsInHandUIs = new List<GameObject>();
|
||||
for (int i = 0; i < hand.Count; i++) {
|
||||
BaseCard card = hand[i];
|
||||
HeroCard card = hand[i];
|
||||
GameObject cardUI = Instantiate(this.cardPrefab, this.uiCanvas.transform);
|
||||
this.cardsInHandUIs.Add(cardUI);
|
||||
cardUI.transform.position = CalculateHandCardPosition(i, hand.Count);
|
||||
|
|
@ -70,9 +71,9 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
0);
|
||||
}
|
||||
|
||||
private void OnCardClicked(BaseCard card) {
|
||||
private void OnCardClicked(HeroCard card) {
|
||||
if (this.singleTargeting == null) {
|
||||
if (this.battleController.CanUseCard(card)) {
|
||||
if (this.battleController.CanUseHeroCard(card)) {
|
||||
OnCardUsed(card);
|
||||
}
|
||||
}
|
||||
|
|
@ -103,7 +104,7 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
}
|
||||
|
||||
public void NotifyHandPileChanged() {
|
||||
SetHand(this.heroDeck.GetHandPile());
|
||||
SetHand(this.heroDeck.GetHandPile().Cast<HeroCard>().ToList());
|
||||
}
|
||||
|
||||
private void NotifyPlayAreaChanged() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue