public void initBullet(Vector3 rot, BulletItemSpec spec, float _speed, float _attack, float _cannonLevel) { bulletSpec = spec; bulletAnimator = transform.GetComponent <Animator>(); bulletAnimator.Play(spec.name); attack = _attack; attackradit = _cannonLevel; float tar = Mathf.Atan2(rot.y, rot.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, 0, tar), 3f); GetComponent <Rigidbody2D> ().AddForce(new Vector2(rot.x * _speed * 2, rot.y * _speed * 2)); }
public void initBullet() { curBulletSpec = SpecController.getItemById(PlayerData.getCurrentBullet()) as BulletItemSpec; }