Пример #1
0
        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);
        }
Пример #2
0
 public void OnCollisionEnter(Collision collision)
 {
     if (collision.GameObject.Id.Equals("ball"))
         SoundSystem.Instance.Play("hitpaddle");
 }
Пример #3
0
 public void OnCollisionEnter(Collision collision)
 {
     SoundSystem.Instance.Play("hitpaddle");
 }