Example #1
0
    // Update is called once per frame
    void Update()
    {
        float mouseX = Mathf.Round(Input.mousePosition.x - 512.0f);

        if (mouseX > 500.0f)
        {
            mouseX = 500.0f;
        }
        if (mouseX < -500.0f)
        {
            mouseX = -500.0f;
        }

        if (isSticked)
        {
            float positionX = mouseX + stickedPointX;
            this.transform.position = new Vector3(positionX, -180.0f, 0.0f);
        }

        if (mainManager.GetDialogStatus() == 2 && !isSticked && !isPrecipitating && signalManager.IsActiveMagnet())
        {
            if (this.transform.position.x > mouseX)
            {
                rigidbody2D.AddForce(new Vector2(-1000.0f, 0.0f), ForceMode2D.Force);
            }
            if (this.transform.position.x < mouseX)
            {
                rigidbody2D.AddForce(new Vector2(1000.0f, 0.0f), ForceMode2D.Force);
            }
        }

        for (int i = 0; i < 10; i++)
        {
            gameObjectsAfterimage[i].transform.position = previousPositions[i];
        }
    }