Exemplo n.º 1
0
    void ChangeTeamColor(int teamIndex, float bumperInput)
    {
        int i = teamColorIndices[teamIndex];
        int otherTeamColorIndex = teamColorIndices[teamIndex == 0 ? 1 : 0];

        while (true)
        {
            i += bumperInput > 0f ? 1 : -1;
            WadeUtils.WrapAround(ref i, 0, GameManager.instance.colorOptions.Length - 1);

            if (i != otherTeamColorIndex)
            {
                teamColorIndices[teamIndex] = i;

                for (int j = 0; j < playerInfos.Length; j++)
                {
                    if (playerInfos[j].teamIndex == teamIndex && playerInfos[j].joined)
                    {
                        playerInfos[j].image.color = GameManager.instance.colorOptions[teamColorIndices[teamIndex]];
                    }
                }

                return;
            }
        }
    }
Exemplo n.º 2
0
    void PlayerJoinGame(int playerNum, int playerIndex)
    {
        playerInfos[playerNum].joined      = true;
        playerInfos[playerNum].playerIndex = playerIndex + 1;

        int teamIndex = playerInfos[playerNum].teamIndex;

        int i = 0;

        int[] availableSpriteIndices = GetAvailableSpriteIndices(playerNum);
        while (true)
        {
            if (availableSpriteIndices.Contains(i))
            {
                playerInfos[playerNum].texIndex = i;
                playerInfos[playerNum].UpdateSprite(playerTexInfos);
                break;
            }

            i++;
            WadeUtils.WrapAround(ref i, 0, playerTexInfos.Length - 1);
        }

        playerInfos[playerNum].image.color = GameManager.instance.colorOptions[teamColorIndices[teamIndex]];
        playerInfos[playerNum].image.transform.GetChild(0).gameObject.SetActive(false);
    }
Exemplo n.º 3
0
    void PlayerChangeSprite(int playerIndex, float scrollAmount)
    {
        int i = playerInfos[playerIndex].texIndex;

        int[] availableSprites = GetAvailableSpriteIndices(playerIndex);

        while (true)
        {
            i += scrollAmount > 0f ? 1 : -1;
            WadeUtils.WrapAround(ref i, 0, playerTexInfos.Length - 1);

            if (availableSprites.Contains(i))
            {
                playerInfos[playerIndex].texIndex = i;
                playerInfos[playerIndex].UpdateSprite(playerTexInfos);
                return;
            }
        }
    }