예제 #1
0
파일: OnTheRocks.cs 프로젝트: hgrandry/Mgx
 private void SetupSnake(Body body, RubeScene scene)
 {
     Add(new SoundListener(body));
     Add(new HeadController(body));
     SetupTail(scene, body);
     SetupControl(body);
 }
예제 #2
0
파일: OnTheRocks.cs 프로젝트: hgrandry/Mgx
 private void SetupStateRecord(RubeScene scene)
 {
     foreach (var name in scene.BodiesNames)
     {
         var body = scene.GetBody(name);
         if (body.BodyType == BodyType.Dynamic)
             Add(new BodyStateRecorder(body, name));
     }
 }
예제 #3
0
파일: OnTheRocks.cs 프로젝트: hgrandry/Mgx
 private void SetupTail(RubeScene scene, Body body)
 {
     var tails = new List<Body>();
     for (var i = 1; i <= 3; i++)
     {
         var b = scene.GetBody("tail" + i);
         tails.Add(b);
     }
     Add(new Tail(body, tails));
 }
예제 #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            //_rubeScene = new RubeScene(@"..\..\..\..\..\RubeData\cartest.json", Content, GraphicsDevice);
            _rubeScene = new RubeScene(@"..\..\..\..\..\RubeData\radar-vehicle-test.json", Content, GraphicsDevice);
            _camera = new Camera(GraphicsDevice.Viewport);
            _font = Content.Load<SpriteFont>("font");

            _physicsDebug = new DebugViewXNA(_rubeScene.World);
            _physicsDebug.LoadContent(GraphicsDevice, Content);
            _physicsDebug.AppendFlags(DebugViewFlags.Shape);
            _physicsDebug.AppendFlags(DebugViewFlags.Controllers);
            _physicsDebug.AppendFlags(DebugViewFlags.DebugPanel);
            _physicsDebug.AppendFlags(DebugViewFlags.PerformanceGraph);

            _car = new Car();
            _rubeScene.AttachJointControllers(_car, "characterWheel");
            _rubeScene.AttachBodyControllers(_car, "chacterbody");
            _car.Init();
        }