void spawnBullet(float xDir, float yDir, GameObject bulletType) { GameObject x = (GameObject)Instantiate(bulletType, gPos, Quaternion.identity); BasicBulletMovement y = x.GetComponent <BasicBulletMovement> (); y.xDir = xDir; y.yDir = yDir; }
void TargetedPattern3BulletSpawner(float xPos, float yPos, GameObject bulletType) { Vector3 normal = new Vector3(sPos.x - xPos, sPos.y - yPos); normal = normal / normal.magnitude; GameObject x = (GameObject)Instantiate(bulletType, new Vector3(xPos, yPos), Quaternion.identity); BasicBulletMovement y = x.GetComponent <BasicBulletMovement> (); y.xDir = normal.x; y.yDir = normal.y; }