Create SingleTargeting
This commit is contained in:
parent
05fee309c3
commit
611601934d
6 changed files with 57 additions and 27 deletions
|
|
@ -61,41 +61,35 @@ public class BattlePlayerControls : MonoBehaviour
|
|||
}
|
||||
|
||||
private void OnCardClicked(BaseCard card) {
|
||||
if (!this.waitingForTarget) {
|
||||
if (this.singleTargeting == null) {
|
||||
if (this.battleController.CanUseCard(card)) {
|
||||
OnCardUsed(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool waitingForTarget = false;
|
||||
private BattleParticipant participantClicked = null;
|
||||
private SingleTargeting singleTargeting;
|
||||
|
||||
public IEnumerator ChooseTarget(System.Action<BattleParticipant> targetCallback) {
|
||||
this.waitingForTarget = true;
|
||||
while (this.participantClicked == null) {
|
||||
yield return null;
|
||||
}
|
||||
this.waitingForTarget = false;
|
||||
targetCallback(participantClicked);
|
||||
this.participantClicked = null;
|
||||
yield break;
|
||||
public IEnumerator ChooseTarget(SingleTargeting targeting) {
|
||||
this.singleTargeting = targeting;
|
||||
yield return this.singleTargeting.ChooseTarget();
|
||||
this.singleTargeting = null;
|
||||
}
|
||||
|
||||
public void OnParticipantSpriteClicked(BattleParticipant paticipant) {
|
||||
if (this.waitingForTarget) {
|
||||
this.participantClicked = paticipant;
|
||||
public void NotifyParticipantSpriteClicked(BattleParticipant participant) {
|
||||
if (this.singleTargeting != null) {
|
||||
this.singleTargeting.NotifyParticipantSpriteClicked(participant);
|
||||
}
|
||||
}
|
||||
|
||||
public void PassTurnButtonClicked() {
|
||||
if (!this.waitingForTarget) {
|
||||
if (this.singleTargeting == null) {
|
||||
OnTurnPassed();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsTargeting() {
|
||||
return this.waitingForTarget;
|
||||
return this.singleTargeting != null;
|
||||
}
|
||||
|
||||
public void NotifyHandPileChanged() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue