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; })); }