public void OnCollisionEnter(Collision collision) { Random random = new Random(); float nextRan = Convert.ToSingle(random.NextDouble()); float velocityX = RigidBody.Velocity.X * -1; float velocityY = RigidBody.Velocity.Y; if (velocityX < 0) velocityX -= nextRan; else velocityX += nextRan; if (velocityY < 0) velocityY -= nextRan; else velocityY += nextRan; RigidBody.Velocity = new Vector2(velocityX, velocityY); }
public void OnCollisionEnter(Collision collision) { if (collision.GameObject.Id.Equals("ball")) SoundSystem.Instance.Play("hitpaddle"); }
public void OnCollisionEnter(Collision collision) { SoundSystem.Instance.Play("hitpaddle"); }