private void ChangeColor()
        {
            var sprite = transform.Find("Background").GetComponentInChildren <SpriteRenderer>();

            bool hasBlackClick = CurrentColorStates.Contains(HighlightState.PLAYER_BLACK_CLICK_HIGHLIGHT);
            bool hasWhiteClick = CurrentColorStates.Contains(HighlightState.PLAYER_WHITE_CLICK_HIGHLIGHT);

            if (hasBlackClick && hasWhiteClick)
            {
                sprite.color = Color.cyan;
            }
            else if (hasBlackClick)
            {
                sprite.color = Color.blue;
            }
            else if (hasWhiteClick)
            {
                sprite.color = Color.green;
            }
            else // HighlightState.DEFAULT or nothing
            {
                sprite.color = PlayerColor == PlayerColor.BLACK ? ColorConst.LightGray : ColorConst.VeryLightRed;
                pieceViewService.ChangePlayerBorder(gameObject, PlayerColor);
            }
        }
示例#2
0
        private void ChangeColor()
        {
            var sprite = GetComponentInChildren <SpriteRenderer>();

            bool hasBlackClick = CurrentColorStates.Contains(HighlightState.PLAYER_BLACK_CLICK_HIGHLIGHT);
            bool hasWhiteClick = CurrentColorStates.Contains(HighlightState.PLAYER_WHITE_CLICK_HIGHLIGHT);

            bool hasBlackRange = CurrentColorStates.Contains(HighlightState.PLAYER_BLACK_RANGE_HIGHLIGHT);
            bool hasWhiteRange = CurrentColorStates.Contains(HighlightState.PLAYER_WHITE_RANGE_HIGHLIGHT);

            if (hasBlackClick && hasWhiteClick)
            {
                sprite.color = Color.yellow;
            }
            else if (hasBlackClick)
            {
                sprite.color = Color.magenta;
            }
            else if (hasWhiteClick)
            {
                sprite.color = Color.red;
            }
            else if (hasBlackRange && hasWhiteRange)
            {
                sprite.color = ColorConst.LightBlue;
            }
            else if (hasBlackRange)
            {
                sprite.color = ColorConst.LightGreen;
            }
            else if (hasWhiteRange)
            {
                sprite.color = ColorConst.LightPink;
            }
            else // HighlightState.DEFAULT or nothing
            {
                sprite.color = ColorConst.Wood;
            }
        }
        private void ChangeColor()
        {
            var sprite = GetComponentInChildren <SpriteRenderer>();

            bool hasBlackClick = CurrentColorStates.Contains(HighlightState.PLAYER_BLACK_CLICK_HIGHLIGHT);
            bool hasWhiteClick = CurrentColorStates.Contains(HighlightState.PLAYER_WHITE_CLICK_HIGHLIGHT);

            if (hasBlackClick && hasWhiteClick)
            {
                sprite.color = Color.cyan;
            }
            else if (hasBlackClick)
            {
                sprite.color = Color.blue;
            }
            else if (hasWhiteClick)
            {
                sprite.color = Color.green;
            }
            else // HighlightState.DEFAULT or nothing
            {
                sprite.color = PlayerColor == PlayerColor.BLACK ? ColorConst.LightRed : ColorConst.VeryLightRed;
            }
        }