예제 #1
0
    void Shoot()
    {
        rot    = ball.transform.eulerAngles;
        rot.x += -14;

        if (rot.y > 180)
        {
            rot.y = rot.y - 360;
        }
        if (rot.x > 180)
        {
            rot.x = rot.x - 360;
        }

        rot.y *= 1.1f;

        float result = potenciometer.value;

        result *= 10;
        if (result < 7)
        {
            result = result * 10 / 7;
        }
        else
        {
            float diff = (result - 7);
            result = 10 + diff;

            if (rot.y < 0)
            {
                rot.y -= diff * 1.5f;
            }
            else
            {
                rot.y += diff * 1.5f;
            }

            rot.x -= (diff * 3);
        }
        if (rot.x > 0)
        {
            rot.x = 0;
        }

        force = Mathf.Lerp(10, 70, (float)result / 10);
        ia.Calculate(rot, (float)result);
    }