예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (collided && changeColour && !ColourWheel.Instance.startSpinning)
        {
            var colour = cm.GetRandomColor(cm.currentColourType);

//			//if the block is the same colour as the top of the background in the higher portion of the level
//			if (transform.position.y > 0 && cm.currentColourType == TopColour)
//			{
//				Disappear();
//			}
//			//if the block is the same colour as the bottom of the background in the lower portion of the level
//			else if (transform.position.y < 0 && cm.currentColourType == BottomColour)
//			{
//				Disappear();
//			}
            sprite.DOColor(colour, transitionDuration).OnComplete(() => {
                if (cm.currentColourType == TopColour || cm.currentColourType == BottomColour)
                {
                    changeColour = false;
                    Disappear();
                    return;
                }
                changeColour = true;
            });
            changeColour = false;
        }
        if (ColourWheel.Instance.startSpinning && !isWhite)
        {
            sprite.DOColor(Color.white, transitionDuration);
            isWhite = true;
        }
        else
        {
            isWhite = false;
        }
    }