Пример #1
0
        public void UpdateMovement()
        {
            if (_dx > SDMConfig.MovThresholdXY)
                _hmov = HorizontalMov.Left;
            else if (_dx < -SDMConfig.MovThresholdXY)
                _hmov = HorizontalMov.Right;
            else
                _hmov = HorizontalMov.Idle;

            if (_dy > SDMConfig.MovThresholdXY)
                _vmov = VerticalMov.Down;
            else if (_dy < -SDMConfig.MovThresholdXY)
                _vmov = VerticalMov.Up;
            else
                _vmov = VerticalMov.Idle;


            var area = Math.Abs(_dh*_dw)*Math.Sign(_dh);

            if (area > SDMConfig.MovThresholdArea)
                _dmov = DeepMov.In;
            else if (area < -SDMConfig.MovThresholdArea)
                _dmov = DeepMov.Out;
            else
                _dmov = DeepMov.Idle;
        }
Пример #2
0
        public void UpdateCommandBox()
        {
            const string outString = "[X] {0,10} , [Y] {1,10} , [Z] {2,10} \n";
            string xString = null, yString = null, zString = null;
            var changed = false;

            zString = _dmov.ToString();
            xString = _hmov.ToString();
            yString = _vmov.ToString();

            if (_dmov != _dmovOld)
            {
                _dmovOld = _dmov;
                changed = true;
            }
            if (_hmov != _hmovOld)
            {
                _hmovOld = _hmov;
                changed = true;
            }
            if (_vmov != _vmovOld)
            {
                _vmovOld = _vmov;
                changed = true;
            }


            if (changed)
                _commandBox.AppendText(string.Format(outString, xString, yString, zString));
        }