Exemplo n.º 1
0
    public void UISelectPlayerAttack(Attack selected)
    {
        // Disable all of the attack buttons (until enemy does its attack).
        foreach (var b in selectActionButtons)
        {
            b.GetComponent <Button>().interactable = false;
        }
        foreach (var b in selectElementButtons)
        {
            b.GetComponent <Button>().interactable = false;
        }
        // foreach(var b in doActionButtons) { b.GetComponent<Button>().interactable = false; }

        // Clicking any attack button triggers the attack. We then add the attack (and its result)
        // to the UIMoveLogMenu.
        bool successful = playerManager.DoAttack(enemyManager, selected);

        if (successful)
        {
            enemyManager.GetComponent <UIHitMarkerDisplay>().ShowHit(selected);
        }
        else
        {
            enemyManager.GetComponent <UIHitMarkerDisplay>().ShowMiss(selected);
        }

        PlayerActionResult result = new PlayerActionResult(playerManager.Element, selected, successful);

        UIMoveLogMenu.GetComponent <MoveLogManager>().AppendPlayerLogEntry(result);

        this.NextTurn();
    }
Exemplo n.º 2
0
    /*
     * Waits asynchronously for a few seconds before taking the enemy's turn.
     */
    private IEnumerator HandleEnemyTurn(GameObject enemy_unit)
    {
        yield return(new WaitForSeconds(2.0f));

        bool successful = enemyManager.DoAttack(playerManager, new GenericEnemyAttack());

        StartCoroutine(ShowEnemyHitOrMissText(successful));

        if (successful)
        {
            IEnumerator coroutine = DoBlinkingEffect(0.2f, 0.05f);
            StartCoroutine(coroutine);
        }

        // It's critical that the playerManager.Element doesn't change between when the enemy
        // does its attack and when this action result is added to the move log.
        EnemyActionResult enemy_result = new EnemyActionResult(successful, playerManager.Element);

        UIMoveLogMenu.GetComponent <MoveLogManager>().AppendEnemyLogEntry(enemy_result);

        this.NextTurn();
    }