private void UpdateForCommand()
        {
            if (EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }

            CharacterModel caster = Player.Selection.Model;

            if (Input.GetMouseButtonUp(autoCurrentAbility ? InputExtensions.RightClick : InputExtensions.LeftClick))
            {
                IGameCommand command = null;

                if (currentAbility == null)
                {
                    command = new MoveCommand()
                    {
                        Character   = caster,
                        CharacterId = caster.Id,
                        Path        = currentPath ?? new List <Data.Vector2>(),
                    };
                }
                else
                {
                    Data.Vector2 targetPosition = abilityCastView.TargetPosition.ToModelVector();
                    if (caster.ActionPoints < currentAbility.ActionPoints)
                    {
                        UserInterface.GameMessageView.AddMessage("Not enough action points");
                    }
                    else if ((caster.Position - targetPosition).Norm > currentAbility.Range)
                    {
                        UserInterface.GameMessageView.AddMessage("Not in range");
                    }
                    else
                    {
                        command = new CastAbilityCommand()
                        {
                            Character   = caster,
                            CharacterId = caster.Id,
                            Ability     = currentAbility,
                            AbilityName = currentAbility.Name,
                            Target      = targetPosition,
                        };
                    }
                }

                if (command != null)
                {
                    Game.Model.ExecuteCommand(command);
                }
                ClearCurrentCommand();
            }

            if (Input.GetMouseButtonUp(autoCurrentAbility ? InputExtensions.LeftClick : InputExtensions.RightClick))
            {
                ClearCurrentCommand();
            }
        }
        private void ShowPath(Data.Vector2 start, Data.Vector2 end)
        {
            start = new Data.Vector2(Mathf.Round(start.X), Mathf.Round(start.Y));
            end   = new Data.Vector2(Mathf.Round(end.X), Mathf.Round(end.Y));

            if ((currentPath == null) || (currentPathStart != start) || (currentPathEnd != end))
            {
                // Debug.LogFormat(this, "[HumanPlayerController] FindPath (Start: {0}, End: {1})", start, end);
                currentPath = new List <Data.Vector2>();
                try { currentPath = Game.Model.Navigation.FindPath(start, end); }
                catch (TimeoutException exception) { Debug.LogWarning(exception); }

                currentPathStart = start;
                currentPathEnd   = end;

                pathView.ShowPath(start.ToUnityVector(), currentPath.Select(node => node.ToUnityVector()).ToList());
            }
        }