Exemplo n.º 1
0
    public void StrikeBall(Vector3 aimRotation, float powerLevel)
    {
        if (teamHit == 1)
        {
            doubleHit = true;
        }
        //rb.velocity = new Vector3(0,0,0); //freeze ball before striking
        transform.rotation = Quaternion.Euler(aimRotation);

        //Debug.Log("vectorUp: " + Vector3.up);
        //Debug.Log("powerLevel: " + powerLevel);
        //Debug.Log("aimRotation: " + aimRotation);
        //Debug.Log("ballRotation: " + transform.rotation.eulerAngles);

        enemy.TransferInfo(aimRotation.x, transform.forward * powerLevel);
        rb.velocity = Vector3.zero;
        rb.AddForce(transform.forward * powerLevel, ForceMode.Impulse);
        //rb.AddForce(transform.forward * powerLevel);
        teamHit = 1;
        round   = true;
    }