コード例 #1
0
        public bool MoveToFormation(UnitGroup units)
        {
            bool executed = false;

            for (; units.IsValid(); units.TryMoveNext())
            {
                if (MoveToFormation(units.Current))
                {
                    executed = true;
                }
            }
            return(executed);
        }
コード例 #2
0
        public bool MoveToFormation(UnitGroup units)
        {
            bool executed = false;

            while (units.IsValid())
            {
                if (MoveToFormation(units.Current))
                {
                    executed = true;
                    units.TryMoveNext();
                }
                else if (spiralPositions.ContainingSquareSize >= maxSize)
                {
                    executed = OverflowUnits(units);
                }
            }
            return(executed);
        }
コード例 #3
0
ファイル: MapFormationController.cs プロジェクト: MK4H/MHUrho
        /// <summary>
        /// Creates a spiral around the provided tile
        /// </summary>
        /// <param name="units"></param>
        public bool MoveToFormation(UnitGroup units)
        {
            if (units == null)
            {
                return(false);
            }

            bool executed = false;

            while (units.IsValid())
            {
                if (MoveToFormation(units.Current))
                {
                    executed = true;
                }

                if (!units.TryMoveNext())
                {
                    break;
                }
            }
            return(executed);
        }