Example #1
0
    IEnumerator GetCharacter()
    {
        int _noOfChars = chosenCharacters.Count;

        yield return(new WaitForEndOfFrame());

        if (_noOfChars == 1)
        {
            MoveCharacter(standingCharacters[chosenCharacters[0]]);
            ingameUIManager.SetOperations(PreGameUIManager.selectedLevel, 0);
        }
        else if (_noOfChars == 2)
        {
            for (int i = 0; i < 2; i++)
            {
                MoveCharacter(standingCharacters[chosenCharacters[i]]);
                ingameUIManager.SetOperations(PreGameUIManager.selectedLevel, i);
                letCharacter = false;
                yield return(new WaitUntil(() => letCharacter == true));
            }
        }
        else if (_noOfChars == 3)
        {
            for (int i = 0; i < 3; i++)
            {
                MoveCharacter(standingCharacters[chosenCharacters[i]]);
                ingameUIManager.SetOperations(PreGameUIManager.selectedLevel, i);
                letCharacter = false;
                yield return(new WaitUntil(() => letCharacter == true));
            }
        }
        else if (_noOfChars == 4)
        {
            for (int i = 0; i < 4; i++)
            {
                MoveCharacter(standingCharacters[chosenCharacters[i]]);
                ingameUIManager.SetOperations(PreGameUIManager.selectedLevel, i);
                letCharacter = false;
                yield return(new WaitUntil(() => letCharacter == true));
            }
        }
    }