Exemplo n.º 1
0
    private void fireArrow()
    {
        if (Input.GetAxis("Fire1") != 0)
        {
            chargeTime += Time.deltaTime * 500;
            chargeTime  = Mathf.Clamp(chargeTime, 20, 500);

            bowObject.localScale    = new Vector3(0.3f + chargeTime / 600f, 0.5f, 0.5f);
            bowObject.localRotation = Quaternion.Euler(-50f - (40f * chargeTime / 700f), 0f, 90f);
        }

        if (Input.GetButtonUp("Fire1"))
        {
            arrowController.SpawnArrow(chargeTime);
            chargeTime              = 0;
            bowObject.localScale    = new Vector3(0.3f, 0.5f, 0.5f);
            bowObject.localRotation = Quaternion.Euler(-50f, 0f, 90f);
        }
    }