// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); dRay = GameObject.FindGameObjectWithTag("DeathRay").GetComponent <DeathRayUpgrade>(); speed = new Vector2(50 * Mathf.Cos(dRay.angle * Mathf.Deg2Rad) + player.rigidbody2D.velocity.x, 50 * Mathf.Sin(dRay.angle * Mathf.Deg2Rad) + player.rigidbody2D.velocity.y); laserSound = Resources.Load <AudioClip>("Sounds/Laser"); AudioSource.PlayClipAtPoint(laserSound, player.transform.position); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); dRay = GameObject.FindGameObjectWithTag("DeathRay").GetComponent<DeathRayUpgrade>(); speed = new Vector2(50 * Mathf.Cos (dRay.angle * Mathf.Deg2Rad) + player.rigidbody2D.velocity.x , 50 * Mathf.Sin (dRay.angle * Mathf.Deg2Rad) + player.rigidbody2D.velocity.y); laserSound = Resources.Load<AudioClip>("Sounds/Laser"); AudioSource.PlayClipAtPoint(laserSound, player.transform.position); }