예제 #1
0
        public void AddObstacles(ObstacleMap obstacleMap)
        {
            if (obstacleMap == null)
            {
                throw new ArgumentNullException();
            }

            foreach (var obstacle in obstacleMap.Obstacles)
            {
                var shape = new Circular(obstacle.Radius);

                // Bouncy balls are made from rubber.
                Body body = m_physicsEngine.AddImmobileBody(shape, obstacle.Position, "BouncyBall");
                body.Position = obstacle.Position;

                TireObstacle tire = new TireObstacle(body);
                m_obstacles.Add(tire);
                _collisionEngine.AddImmobileBody(body);
            }
        }