void Start() { startposition = transform.position; var angle = transform.eulerAngles.z; body = GetComponent <Rigidbody2D>(); body.velocity = Vector2Utils.CreateVector(Speed, angle * Mathf.Deg2Rad); }
private void OnCollisionEnter2D(Collision2D other) { if (!other.gameObject.CompareTag("Reflective")) { return; } Vector2 reflected = Vector3.Reflect(Vector2Utils.CreateVector(1, Angle * Mathf.Deg2Rad), other.GetContact(0).normal); Angle = reflected.GetAngle() * Mathf.Rad2Deg; OnHitShield(); }
private void LateUpdate() { Body.velocity = Vector2Utils.CreateVector(Speed, Angle * Mathf.Deg2Rad); }