예제 #1
0
    public CharacterControllerSample(Microsoft.Xna.Framework.Game game)
      : base(game)
    {
      Services.Register(typeof(DebugRenderer), null, GraphicsScreen.DebugRenderer);

      // Add basic force effects.
      Simulation.ForceEffects.Add(new Gravity());
      Simulation.ForceEffects.Add(new Damping());

      // Add a game object which loads and updates the test obstacles.
      GameObjectService.Objects.Add(new CharacterControllerLevelObject(Services));

      // Add a game object which uses a character controller.
      _characterControllerObject = new CharacterControllerObject(Services);
      GameObjectService.Objects.Add(_characterControllerObject);

      // Add a camera that is attached to the character controller.
      var cameraObject = new ThirdPersonCameraObject(_characterControllerObject, Services);
      GameObjectService.Objects.Add(cameraObject);
      GraphicsScreen.CameraNode = cameraObject.CameraNode;
    }
예제 #2
0
        public CharacterControllerSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            Services.Register(typeof(DebugRenderer), null, GraphicsScreen.DebugRenderer);

            // Add basic force effects.
            Simulation.ForceEffects.Add(new Gravity());
            Simulation.ForceEffects.Add(new Damping());

            // Add a game object which loads and updates the test obstacles.
            GameObjectService.Objects.Add(new CharacterControllerLevelObject(Services));

            // Add a game object which uses a character controller.
            _characterControllerObject = new CharacterControllerObject(Services);
            GameObjectService.Objects.Add(_characterControllerObject);

            // Add a camera that is attached to the character controller.
            var cameraObject = new ThirdPersonCameraObject(_characterControllerObject, Services);

            GameObjectService.Objects.Add(cameraObject);
            GraphicsScreen.CameraNode = cameraObject.CameraNode;
        }