Beispiel #1
0
        public void Update()
        {
            if ((_autoActionBlocking) || (_movementBlockDuration > 0.0f))
            {
                _motionEngine.StopMoving();
            }
            else if (_isMoving)
            {
                Vector2 vectorToTarget = _movementTarget - _transform.position;

                if (vectorToTarget.magnitude > Movement_Target_Stopping_Distance)
                {
                    _motionEngine.MoveTowardsPosition(_movementTarget);
                    _displayController.IsMoving = true;
                    _displayController.SetFacing(_movementTarget);
                }
                else
                {
                    EndFieldMovement();
                    _statusEventDispatcher.FireStatusEvent(StatusMessage.CompletedFieldMovement);
                }
            }

            _movementBlockDuration = Mathf.Max(_movementBlockDuration - Time.deltaTime, 0.0f);
        }