Esempio n. 1
0
        /// <summary>
        /// IEnumerator that yields until a selection was made.
        /// </summary>
        /// <param name="mode"></param>
        /// <param name="entityToPosition"></param>
        /// <param name="setInteractive"></param>
        /// <param name="abortable"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        private IEnumerator WaitForSelection(IPositionable entityToPosition, bool setInteractive = true, bool abortable = true, int mode = 0)
        {
            Game.StopSkipping();

            Aborted       = false;
            Enabled       = true;
            Visible       = true;
            SelectionMade = false;

            bool previousWorldInteractive = World.Interactive;

            if (setInteractive)
            {
                World.Interactive = true;
            }

            entityToPosition.BeginPosition(mode);

            while (!SelectionMade && !Aborted)
            {
                SetPosition(entityToPosition, mode);
                yield return(0);
            }

            SetPosition(entityToPosition, mode);
            entityToPosition.EndPosition(mode);

            if (setInteractive)
            {
                World.Interactive = previousWorldInteractive;
            }

            Enabled = false;
            Visible = false;
        }