Exemplo n.º 1
0
    private void MoveSelection(int delta)
    {
        Doll oldSelected = GetSelectedDoll();

        if (oldSelected != null)
        {
            oldSelected.GetComponent <Selectable>().selected = false;
        }

        int max = dolls.Count;

        do
        {
            selectionIndex += delta;
            if (selectionIndex < 0)
            {
                selectionIndex = max - 1;
            }
            else if (selectionIndex >= max)
            {
                selectionIndex = 0;
            }
        } while (GetSelectedDoll().unit.IsDead());

        Doll newSelected = GetSelectedDoll();

        newSelected.GetComponent <Selectable>().selected = true;
        if (newSelected.unit.align == Alignment.Enemy)
        {
            StartCoroutine(newSelected.unit.battle.controller.enemyHUD.enableRoutine(newSelected.unit));
        }

        if (oldSelected != newSelected)
        {
            Global.Instance().Audio.PlaySFX("cursor");
        }
    }