Пример #1
0
    //---------------------------------------
    private void throwBall()
    {
        ball.SetActive(true);
        ball.transform.position = objCanion.transform.position;
        ball.transform.rotation = objCanion.transform.rotation;

        ball.GetComponent <Rigidbody2D>().velocity = objCanion.transform.right;
        ball.GetComponent <Rigidbody2D>().AddForce(new Vector2(1, 1));
        ball.GetComponent <Rigidbody2D>().velocity    *= 5.5f;
        ball.GetComponent <Rigidbody2D>().velocity    *= -1;
        ball.GetComponent <Rigidbody2D>().velocity    *= velBullet;
        ball.GetComponent <Rigidbody2D>().gravityScale = 1;
        audioHandler.InstanceCanonBallSound();
    }