예제 #1
0
    private void SetPlayerAlive(bool value)
    {
        isAlive = value;

        inactiveTextHolder.SetActive(!isAlive);
        activeTextHolder.SetActive(isAlive);

        currentOption = (isAlive) ? TITLEOPTION.color : TITLEOPTION.inactive;

        if (!otherPlayer.IsPlayerAlive())
        {
            MoveToColor(currentColorIndex);
        }
        else
        {
            if (SelectColor(currentColorIndex))
            {
                MoveToColor(currentColorIndex);
            }
            else
            {
                int nextColor = currentColorIndex + 1;
                if (nextColor >= colorImages.Count)
                {
                    nextColor = 0;
                }
                SelectColor(nextColor);
                MoveToColor(nextColor);
            }
        }

        otherPlayer.OtherPlayerAlive(value);

        if (isAlive)
        {
            startGameText.PlayerActive();
        }
        else
        {
            startGameText.PlayerUnactive();
        }
    }
예제 #2
0
    void Update()
    {
        switch (currentOption)
        {
        case TITLEOPTION.inactive:
            if (AnyButtonDown())
            {
                SetPlayerAlive(true);
            }
            break;

        case TITLEOPTION.color:
            if (Input.GetKeyDown(moveKeyLeft))
            {
                --currentColorIndex;
                if (currentColorIndex < 0)
                {
                    currentColorIndex = colorImages.Count - 1;
                }
                if (otherPlayer.IsPlayerAlive() && currentColorIndex == otherPlayer.GetPlayerSelectedColorIndex())
                {
                    --currentColorIndex;
                    if (currentColorIndex < 0)
                    {
                        currentColorIndex = colorImages.Count - 1;
                    }
                }
                MoveToColor(currentColorIndex);
            }
            if (Input.GetKeyDown(moveKeyRight))
            {
                ++currentColorIndex;
                if (currentColorIndex >= colorImages.Count)
                {
                    currentColorIndex = 0;
                }
                if (otherPlayer.IsPlayerAlive() && currentColorIndex == otherPlayer.GetPlayerSelectedColorIndex())
                {
                    ++currentColorIndex;
                    if (currentColorIndex >= colorImages.Count)
                    {
                        currentColorIndex = 0;
                    }
                }
                MoveToColor(currentColorIndex);
            }
            if (Input.GetKeyDown(moveKeyDown))
            {
                currentOption = TITLEOPTION.ready;
                MoveToReady();
            }
            if (Input.GetKeyDown(selectKey))
            {
                SelectColor(currentColorIndex);
            }
            break;

        case TITLEOPTION.ready:
            if (Input.GetKeyDown(selectKey))
            {
                SetPlayerReady(!isReady);
            }
            if (!isReady)
            {
                if (Input.GetKeyDown(moveKeyUp))
                {
                    currentOption = TITLEOPTION.color;
                    MoveToColor(currentColorIndex);
                }
                if (Input.GetKeyDown(moveKeyDown))
                {
                    currentOption = TITLEOPTION.backout;
                    MoveToBackout();
                }
            }
            break;

        case TITLEOPTION.backout:
            if (Input.GetKeyDown(selectKey))
            {
                SetPlayerAlive(false);
            }
            if (Input.GetKeyDown(moveKeyUp))
            {
                currentOption = TITLEOPTION.ready;
                MoveToReady();
            }
            break;
        }
    }