Beispiel #1
0
    public void toggleMatch3Phase()
    {
        if (match3Uses < 0 && isMatch3Phase || match3_ref.GetMovingBox() != null)
        {
            return;
        }

        isMatch3Phase = !isMatch3Phase;

        if (isMatch3Phase)
        {
            match3Uses--;
            if (match3Uses < 0)
            {
                match3Uses = 0;
            }

            scoreUI.UpdateMatch3Uses(match3Uses);
        }
        else
        {
            foreach (Box b in UtilityTools.FindComponentsWithTag <Box>("Box"))
            {
                if (b.isHighlighted)
                {
                    b.Highlight(false);
                }

                if (b.transform.localScale.x > 1)
                {
                    if (b.GetKillSequence() != null)
                    {
                        if (b.GetKillSequence().IsPlaying())
                        {
                            continue;
                        }
                    }

                    b.transform.DOScale(Vector3.one, TheGrid.moveTime);
                    Vector3 temp = b.transform.position;
                    temp.z = -1;
                    b.transform.position = temp;
                }
            }
        }

        //darrken some sprites when in this mode
        float h, s, v;

        if (gridLayout_ref)
        {
            foreach (Transform go in gridLayout_ref.transform)
            {
                SpriteRenderer tile = go.GetComponent <SpriteRenderer>();
                if (tile != null)
                {
                    Color normal = Tile.getKindColor(go.GetComponent <Tile>().GetKind());

                    Color.RGBToHSV(normal, out h, out s, out v);

                    v *= 0.5f;

                    Color desaturated = Color.HSVToRGB(h, s, v);

                    tile.DOColor((isMatch3Phase) ? desaturated : normal, TheGrid.moveTime * 2);
                }
            }
        }
        player.GetComponent <SpriteRenderer>().DOColor((isMatch3Phase) ? Color.gray : Color.white, TheGrid.moveTime * 2);
    }