// Use this for initialization
    void Start()
    {
        bow       = GameObject.FindGameObjectWithTag("Bow");
        bowscript = bow.GetComponent <BowControlMouse>();
        //Set rotation to be that of the bow
        transform.rotation = bow.transform.rotation;
        rb = this.GetComponent <Rigidbody2D> ();

        //Get the swipepower from the other script


        //Add the force of the shot

        finalForce = (bowscript.swipePower * 400);
        //Make sure the shot power isnt higher than 600

        if (finalForce > 680)
        {
            finalForce = 680;
        }


        //Add the force of the shot
        print("Fired Shot");
        rb.AddRelativeForce(new Vector2(0, finalForce), ForceMode2D.Impulse);
        bowscript.drawbackPosition = bowscript.drawbackResetPosition;

        StartCoroutine("Destroy");
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     bowscript = GameObject.FindGameObjectWithTag("Bow").GetComponent <BowControlMouse> ();
 }