Example #1
0
        /// <summary>
        /// Performs the primary actions of the class: dispatching commands to SelectAction and handling possible navigation failures.
        /// </summary>
        /// <param name="moveTo">
        /// a delegate for calling the desired type of tree navigation.
        /// </param>
        private void MoveTo(MoveToDelegate moveTo)
        {
            lock (_lockObject)
            {
                if (this.Controller == null)
                {
                    return;
                }
                if (!this.Controller.IsTreeNavigationAllowed())
                {
                    return;
                }

                try
                {
                    var selectAction = SelectAction.GetDefaultInstance();
                    moveTo(selectAction?.TreeTracker);
                    this.SelectionChanged?.Invoke();
                }
                catch (TreeNavigationFailedException e)
                {
                    e.ReportException();
                    HandleTreeNavigationFailure();
                }
            } // lock
        }
Example #2
0
 public void MoveTo(Point point)
 {
     if (control.InvokeRequired)
     {
         MoveToDelegate del = new MoveToDelegate(MoveTo);
         control.Invoke(del, new object[] { point });
     }
     else
     {
         control.Location = point;
         form.Refresh();
     }
 }
Example #3
0
 public WalkToState(PlayerCharacter character, StateMachine stateMachine, Vector3 destination,
                    bool checkCollision) :
     base(character, stateMachine)
 {
     _transform   = Character.Transform;
     _destination = destination;
     _controller  = Character.Controller;
     if (checkCollision)
     {
         _move = MoveToWithCollision;
     }
     else
     {
         _move = MoveTo;
     }
 }