/*      Perhaps will not be needed
     *
     * public void MoveTo(Vector3 position)
     * {
     * MoveAction moveAction = new MoveAction(position, null);
     *
     * currentActions.Clear();     //TODO temporary, TBD if moving should cancel all actions
     *
     * currentActions.Add(moveAction);
     * }
     */

    private void ProcessActions()
    {
        if (status == Status.Inactive)
        {
            return;
        }

        if (!GameController.Singleton.isShiftActive)
        {
            if (status != Status.GoingHome)
            {
                GoHome();
            }
            else
            {
                currentActions[0].Perform();
            }
        }

        CharacterAction completedAction = currentActions.Find(x => x.isDone);

        if (completedAction != null)
        {
            currentActions.Remove(completedAction);
            status = Status.Idle;
        }

        if (status == Status.Idle)
        {
            CharacterAction actionToStart = currentActions.Find(x => !x.isDone && !x.inProgress);

            if (actionToStart != null)
            {
                actionToStart.Start();

                status = Status.PerformingAction;
            }
        }
        else
        {
            CharacterAction actionInProgress = currentActions.Find(x => !x.isDone && x.inProgress);

            if (actionInProgress != null)
            {
                actionInProgress.Perform();
            }
        }
    }