public void waitingTurn() { pick.interactable = false; battleZone.enabled = false; foreach (GameObject obj in battleField) { HeroCard card = obj.GetComponent <HeroCard>(); card.attackTurn = false; card.updateState(Enums.State.SLEEPING); } updateHandView(true); }
public void startTurn() { pick.interactable = true; battleZone.enabled = true; foreach (GameObject obj in battleField) { HeroCard card = obj.GetComponent <HeroCard>(); if (card.turnCount > 0) { card.attackTurn = true; card.canAttack = true; card.updateState(Enums.State.ACTIVE); } } updateHandView(false); }
private void battle(GameObject obj) { HeroCard card = obj.GetComponent <HeroCard>(); card.subscribeToBattle(); if (card.data.type == Type.HERO) { int damage = tempCard.power - card.armor; if (damage > 0) { card.armor = 0; card.health -= damage; } else if (damage == 0) { card.armor = 0; } else { card.armor -= tempCard.power; } if (battleLog != null) { battleLog(); } if (card.health <= 0) { moveToDead(obj, card); } } StopCoroutine(cancelCoroutine); tempCard.canAttack = false; tempCard.updateState(State.SLEEPING); }