// Use this for initialization void Start () { _parent = transform.parent.gameObject; bulletSpotController = _parent.GetComponent<BulletSpotController>(); speedRate = bulletSpotController.speedRate; speedX = bulletSpotController.speedX; rb = GetComponent<Rigidbody2D>(); bulletDirection = new Vector3(speedX * speedRate,0.0f,0.0f); rb.velocity = bulletDirection; }
// Use this for initialization void Start() { _parent = transform.parent.gameObject; bulletSpotController = _parent.GetComponent <BulletSpotController>(); speedRate = bulletSpotController.speedRate; speedX = bulletSpotController.speedX; rb = GetComponent <Rigidbody2D>(); bulletDirection = new Vector3(speedX * speedRate, 0.0f, 0.0f); rb.velocity = bulletDirection; }
// Use this for initialization void Start () { _parent = transform.parent.gameObject; bulletSpotController = _parent.GetComponent<BulletSpotController>(); speedRate = bulletSpotController.speedRate; rb = GetComponent<Rigidbody2D>(); balloon = GameObject.FindGameObjectWithTag("Balloon"); balloonPosition = balloon.transform.position; bulletPosition = transform.position; bulletDirection = (balloonPosition - bulletPosition).normalized; bulletSpeedDirection = new Vector3(bulletDirection.x * speedRate,bulletDirection.y * speedRate,bulletDirection.z); rb.velocity = bulletSpeedDirection; }
// Use this for initialization void Start() { _parent = transform.parent.gameObject; bulletSpotController = _parent.GetComponent <BulletSpotController>(); speedRate = bulletSpotController.speedRate; rb = GetComponent <Rigidbody2D>(); balloon = GameObject.FindGameObjectWithTag("Balloon"); balloonPosition = balloon.transform.position; bulletPosition = transform.position; bulletDirection = (balloonPosition - bulletPosition).normalized; bulletSpeedDirection = new Vector3(bulletDirection.x * speedRate, bulletDirection.y * speedRate, bulletDirection.z); rb.velocity = bulletSpeedDirection; }