private void spell() { this.waitingForSelection = true; Selector selector = Selector.Create(Game.current.spells.Cast <IConsumable>().ToList()); StartCoroutine(AsyncHelper.WaitFor(() => selector.selectionEnded, () => { Spell s = selector.selected as Spell; Destroy(selector.gameObject); List <BattleCharacter> options; if (selector.selected.getType() == "health") { options = BattleQueue.alivePlayers(); } else { options = BattleQueue.aliveEnemies(); } CharacterSelector.SelectOne(options); StartCoroutine(AsyncHelper.WaitFor(() => CharacterSelector.selectionConfirmed, () => { castSpell(s, CharacterSelector.selected); CharacterSelector.Reset(); this.waitingForSelection = false; })); })); }
private void attack() { this.waitingForSelection = true; CharacterSelector.SelectOne(BattleQueue.enemySquad.aliveCharacters()); StartCoroutine(AsyncHelper.WaitFor(() => CharacterSelector.selectionConfirmed, () => { attack(CharacterSelector.selected); CharacterSelector.Reset(); this.waitingForSelection = false; })); }
protected override void HandleTurnChanged(TurnTypes.Turn turn) { var isPlayerTurn = turn == TurnTypes.Turn.Player; _spriteController.SetIsSelectable(isPlayerTurn); _unitSelector.IsSelectable = isPlayerTurn; UnitMovement.SetCanMove(isPlayerTurn); if (!isPlayerTurn) { _isSelected = false; _unitSelector.Reset(); } }