public override void HandleInput(InputState inputState)
        {
            if (GameGlobals.EntityID == null)
                return;

            if (_player == null)
            {
                _player = ServiceManager.RetrieveEntityByID((ulong) GameGlobals.EntityID);
            }

            // Get the transform component
            var transformComponent = _player.GetComponent<TransformComponent>();

            const int ABSOLUTE_SPEED = 3;

            // We adjust instant velocity as needed here)
            Vector2 newVector = Vector2.Zero;

            if (inputState.NotMoving())
                newVector = Vector2.Zero;

            if (inputState.MoveLeftIssued())
                newVector -= new Vector2(ABSOLUTE_SPEED * 1, 0);

            if (inputState.MoveRightIssued())
                newVector += new Vector2(ABSOLUTE_SPEED * 1, 0);

            if (inputState.MoveUpIssued())
                newVector -= new Vector2(0, ABSOLUTE_SPEED * 1);

            if (inputState.MoveDownIssued())
                newVector += new Vector2(0, ABSOLUTE_SPEED * 1);

            if (newVector != transformComponent.Velocity)
                transformComponent.Velocity = newVector;
        }
 public override void HandleInput(InputState inputState)
 {
 }
 public override void HandleInput(InputState input)
 {
     ServiceContainer.UpdateInput(input);
     base.HandleInput(input);
 }
 public override void HandleInput(InputState inputState)
 {
     //throw new NotImplementedException();
 }
 public void UpdateInput(InputState inputState)
 {
     foreach (var service in _services)
         service.HandleInput(inputState);
 }
Example #6
0
 /// <summary>
 /// Used to process user input for a particular sub system
 /// </summary>
 /// <param name="inputState"></param>
 public abstract void HandleInput(InputState inputState);
Example #7
0
 /// <summary>
 /// Allows the screen to handle user input. Unlike Update, this method
 /// is only called when the screen is active, and not when some other
 /// screen has taken the focus.
 /// </summary>
 public virtual void HandleInput(InputState input)
 {
 }