예제 #1
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        public ThirdPersonCameraObject(CharacterControllerObject characterControllerObject, IServiceLocator services)
        {
            Name = "ThirdPersonCamera";

            _characterControllerObject = characterControllerObject;

            _services     = services;
            _inputService = services.GetInstance <IInputService>();
        }
        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.
            _characterControllerLevelObject = new CharacterControllerLevelObject(Services);
            GameObjectService.Objects.Add(_characterControllerLevelObject);

            // 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.
            _cameraObject = new ThirdPersonCameraObject(_characterControllerObject, Services);
            GameObjectService.Objects.Add(_cameraObject);
            GraphicsScreen.CameraNode = _cameraObject.CameraNode;
        }