Ejemplo n.º 1
0
    public void Fire()
    {
        GameObject tempBullet = Instantiate(Bullet, emitter.position, transform.rotation, null);


        Vector3 heading = emitter.transform.position - transform.position;

        heading = heading / heading.magnitude;
        tempBullet.GetComponent <Rigidbody>().AddForce(heading * force);
        tempBullet.GetComponent <Bullet>().Init(gravity, false);
        gravity.AddObject(tempBullet.GetComponent <Rigidbody>());
    }