示例#1
0
    // Update is called once per frame


    // Update is called once per frame
    void Update()
    {
        if (WoodCutter.instance.getIsCutting())
        {
            if (count == 5)
            {
                count = 0;
            }

            troncoCortado.gameObject.SetActive(false);
            wood[count].gameObject.SetActive(true);
            rdbWood[count].AddTorque(power);
            rdbWood[count].AddForce(Vector2.up * power);

            if (player.getIsFlipped())
            {
                rdbWood[count].AddForce(Vector2.right * power);
            }
            else
            {
                rdbWood[count].AddForce(Vector2.left * power);
            }



            for (int i = 0; i < 5; i++)
            {
                if (wood[i].transform.position.x > -1 || wood[i].transform.position.x < -11)
                {
                    wood[i].transform.position = pos;
                    wood[i].gameObject.SetActive(false);
                }
            }



            StartCoroutine(waitSecondsToActive(0.2f));

            count++;
        }
    }