Create PlayerAction and use hero cards in parallel
This commit is contained in:
parent
d48780d629
commit
a2ced7a003
5 changed files with 61 additions and 25 deletions
|
|
@ -12,11 +12,6 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
public GameObject uiCanvas;
|
||||
public GameObject cardPrefab;
|
||||
|
||||
public delegate void CardUsedAction(HeroCard card);
|
||||
public event CardUsedAction OnCardUsed;
|
||||
public delegate void TurnPassedAction();
|
||||
public event TurnPassedAction OnTurnPassed;
|
||||
|
||||
private BattleDeck<HeroCard> heroDeck;
|
||||
private BattleDeck<MonsterCard> monsterDeck;
|
||||
private PlayArea playArea;
|
||||
|
|
@ -26,6 +21,7 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
private HandControls<HeroCard> heroHandControls;
|
||||
private HandControls<MonsterCard> monsterHandControls;
|
||||
private Dictionary<BaseCard, GameObject> cardsInPlayUIs;
|
||||
public PlayerAction playerAction;
|
||||
|
||||
public void Init(
|
||||
BattleDeck<HeroCard> heroDeck, BattleDeck<MonsterCard> monsterDeck, PlayArea playArea,
|
||||
|
|
@ -65,7 +61,7 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
private void OnHeroCardClicked(HeroCard card) {
|
||||
if (this.singleTargeting == null) {
|
||||
if (this.battleController.CanUseHeroCard(card)) {
|
||||
OnCardUsed(card);
|
||||
this.playerAction = new PlayerAction(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +85,7 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
|
||||
public void PassTurnButtonClicked() {
|
||||
if (this.singleTargeting == null) {
|
||||
OnTurnPassed();
|
||||
this.playerAction = new PlayerAction(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -150,4 +146,10 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
public void NotifyInsightLevelChanged() {
|
||||
this.monsterHandControls.InsightLevel = this.insightLevel.Level;
|
||||
}
|
||||
|
||||
public PlayerAction RetrievePlayerAction() {
|
||||
PlayerAction result = this.playerAction;
|
||||
this.playerAction = null;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue