示例#1
0
        private bool OnCollision(Fixture fixtureA, Fixture fixtureB, Contact contact)
        {
            if (!_isAttachedToPaddle)
            {
                if (fixtureB.Body == _paddle.Body)
                {
                    _player.ResetStreak();

                    if (DateTime.Now < _paddleCollisionTime)
                    {
                        return(true);
                    }

                    _paddleCollisionTime = DateTime.Now.AddMilliseconds(200);
                }

                // Don't play the bounce sound if the player is going to score
                // That will get handled elsewhere
                if (!String.Equals(fixtureB.Body.UserData as string, "BLOCK"))
                {
                    _bounce.Play(0.75f, 0, 0);
                }
            }

            return(true);
        }