void Launch() { GameObject laserObject = Instantiate(laserPrefab, rigidbody2D.position + Vector2.right * 0.5f, Quaternion.identity); LaserController laser = laserObject.GetComponent <LaserController>(); laser.Launch(Vector2.right, laserForce); //PlaySound(launch); }
void Launch(Quaternion angle) { GameObject BulletObject = Instantiate(BulletPrefab, transform.position, angle); LaserController Laser = BulletObject.GetComponent <LaserController>(); Laser.Launch(projectileVelocity); }
void ShootLaser() { GameObject laserObject = Instantiate(laserPrefab, rigidBody2D.position + new Vector2(0.08f, 0.1f), Quaternion.identity); LaserController lc = laserObject.GetComponent <LaserController>(); Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position; difference = -difference; float angle = Mathf.Atan2(-difference.x, difference.y) * Mathf.Rad2Deg; lc.Launch(angle); blockTimer = laserBlockTime; }