示例#1
0
    void Update()
    {
        if (isAnimating)
        {
            transform.localPosition = new Vector2(transform.localPosition.x + animEditor, transform.localPosition.y);
        }

        if (!isHovering)
        {
            addSquareHasBeenCalled = false;
        }

        if (fallInitialized)
        {
            if (lineScript.fallDown == true && fallCounter > 0)
            {
                //transform.localPosition = Vector3.SmoothDamp(transform.localPosition, targetPos, ref velocity, 0.1f);

                float step = 7f * Time.deltaTime;

                transform.localPosition = Vector3.MoveTowards(transform.localPosition, targetPos, step);

                if (targetPos.y == transform.localPosition.y)
                {
                    fallInitialized = false;

                    fallCounter = 0;

                    firstFall = false;

                    NameSquare();

                    lineScript.AddToFallCounter();

                    if (firstFall)
                    {
                        UpdateCountDown();
                    }
                }
            }
        }


        if (platformInt == 0)
        {
            if (!(Input.GetMouseButton(0) || Input.GetMouseButtonDown(0)))
            {
                addSquareHasBeenCalled = false;

                hoverSwitch = false;
            }
        }

        else if (platformInt > 0)
        {
            if (Input.touchCount == 0)
            {
                addSquareHasBeenCalled = false;

                hoverSwitch = false;
            }
        }
    }