Esempio n. 1
0
    private bool _drawDebugInfo;   // true if the collision shapes should be drawn for debugging.


    public ContentPipelineSample(Microsoft.Xna.Framework.Game game)
      : base(game)
    {
      SampleFramework.IsMouseVisible = false;
      GraphicsScreen.ClearBackground = true;
      GraphicsScreen.BackgroundColor = Color.CornflowerBlue; 
      SetCamera(new Vector3F(0, 1, 10), 0, 0);

      // Initialize collision detection.
      // Note: The physics Simulation also has a collision domain (Simulation.CollisionDomain)
      // which we could use and which is updated together with the Simulation in
      // SampleGame.cs. But in this example we create our own CollisionDomain for demonstration
      // purposes.
      _collisionDomain = new CollisionDomain(new CollisionDetection());

      // Register CollisionDomain in service container.
      Services.Register(typeof(CollisionDomain), null, _collisionDomain);
      
      // Add game objects which manage graphics models and their collision representations.  
      _saucerObject = new SaucerObject(Services) { Name = "Saucer" };
      _shipObjectA = new ShipObject(Services) { Name = "ShipA" };
      _shipObjectB = new ShipObject(Services) { Name = "ShipB" };

      GameObjectService.Objects.Add(_saucerObject);
      GameObjectService.Objects.Add(_shipObjectA);
      GameObjectService.Objects.Add(_shipObjectB);

      // Position the second ship right of the first ship with an arbitrary rotation.
      _shipObjectB.Pose = new Pose(new Vector3F(2, 0, 0), QuaternionF.CreateRotationY(0.7f) * QuaternionF.CreateRotationX(1.2f));

      // Position the saucer left of the first ship with an arbitrary rotation.
      _saucerObject.Pose = new Pose(new Vector3F(-2.5f, 0, 0), QuaternionF.CreateRotationY(0.2f) * QuaternionF.CreateRotationX(0.4f));
    }
        private bool _drawDebugInfo; // true if the collision shapes should be drawn for debugging.


        public ContentPipelineSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            SampleFramework.IsMouseVisible = false;
            GraphicsScreen.ClearBackground = true;
            GraphicsScreen.BackgroundColor = Color.CornflowerBlue;
            SetCamera(new Vector3(0, 1, 10), 0, 0);

            // Initialize collision detection.
            // Note: The physics Simulation also has a collision domain (Simulation.CollisionDomain)
            // which we could use and which is updated together with the Simulation in
            // SampleGame.cs. But in this example we create our own CollisionDomain for demonstration
            // purposes.
            _collisionDomain = new CollisionDomain(new CollisionDetection());

            // Register CollisionDomain in service container.
            Services.Register(typeof(CollisionDomain), null, _collisionDomain);

            // Add game objects which manage graphics models and their collision representations.
            _saucerObject = new SaucerObject(Services)
            {
                Name = "Saucer"
            };
            _shipObjectA = new ShipObject(Services)
            {
                Name = "ShipA"
            };
            _shipObjectB = new ShipObject(Services)
            {
                Name = "ShipB"
            };

            GameObjectService.Objects.Add(_saucerObject);
            GameObjectService.Objects.Add(_shipObjectA);
            GameObjectService.Objects.Add(_shipObjectB);

            // Position the second ship right of the first ship with an arbitrary rotation.
            _shipObjectB.Pose = new Pose(new Vector3(2, 0, 0), Quaternion.CreateRotationY(0.7f) * Quaternion.CreateRotationX(1.2f));

            // Position the saucer left of the first ship with an arbitrary rotation.
            _saucerObject.Pose = new Pose(new Vector3(-2.5f, 0, 0), Quaternion.CreateRotationY(0.2f) * Quaternion.CreateRotationX(0.4f));
        }