Esempio n. 1
0
 public GameContext(Game game)
 {
     Game = game;
     Graphics = new GraphicsContext();
     View = new ViewContext();
     Resources = new ResourceContext();
     Input = new InputContext(this);
     Scenes = new SceneManager(this);
 }
Esempio n. 2
0
        public GuiManager(InputContext inputContext, GraphicsDevice device, SpriteBatch spriteBatch = null)
        {
            this.inputContext = inputContext;
            this.device = device;
            this.spriteBatch = spriteBatch ?? new SpriteBatch(device);
            availableSize = device.Viewport.Bounds;

            Elements = new List<UIElement>();

            inputContext.Keyboard.KeyPressed += inputContext_KeyPressed;
        }
        public void Initialize(InputContext inputContext)
        {
            this.inputContext = inputContext;

            playerComponent = Owner.Components.Get<PlayerComponent>();
            spatialComponent = Owner.Components.Get<SpatialComponent>();
            controller = spatialComponent.RigidBody.Tag as CharacterController;

            var globalSettings = ServiceLocator.Get<GlobalSettings>();
            messageHandler = ServiceLocator.Get<IMessageHandler>();
            gameClient = ServiceLocator.Get<IGameClient>();

            // Movement
            lookAroundAmplifier = globalSettings.Player.Movement.LookAroundAmplifier;
            movementAmplifier = globalSettings.Player.Movement.MovementAmplifier;
            crouchingMovementReduction = globalSettings.Player.Movement.CrouchingMovementReduction;

            IsEnabled = true;
        }