Ejemplo n.º 1
0
        private void OnUpdate()
        {
            //Get the input direction and normalize it. For some reason the input is inverted, so we take the negative of the axis to get the correct values.
            Vector2 inputDir = new Vector2(-MovementUtilities.GetHorizontalInput(), -MovementUtilities.GetVerticalInput());

            inputDir.Normalize();

            //Zero out the input direction if we cannot move.
            if (!canMove)
            {
                inputDir = Vector2.Zero;
            }

            //Pass the input direction to the movement handler method, and invoke it.
            Move(inputDir);
        }