Beispiel #1
0
        public void TestInsert()
        {
            Deque<int> test = new Deque<int>(10);
            test.Add(0);
            test.Add(1);
            test.Add(2);
            test.Add(3);
            test.Add(4);
            test.Add(5);
            test.Add(6);
            test.Add(7);
            test.Add(8);
            test.Add(9);
            test.RemoveAt(0);
            test.RemoveAt(0);
            test.Insert(3, 7);
            test.Insert(3, 8);

            CollectionAssert.AreEqual(test.ToArray(), new int[] { 2, 3, 4, 8, 7, 5, 6, 7, 8, 9 });
            Assert.AreEqual(test.Count, 10);
        }
Beispiel #2
0
        public void IndexerGetLargeTest()
        {
            const int repetition = 10000;
            var       array      = new Deque <int>();

            for (int i = 0; i < repetition; i++)
            {
                array.Add(i);
            }
            Assert.AreEqual(0, array[0]);
            Assert.AreEqual(repetition - 1, array[repetition - 1]);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                var temp = array[-1];
            });
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                var temp = array[repetition];
            });
        }
        public void Clone()
        {
            Deque <int> deque1, deque2, deque3, deque4;

            deque1 = new Deque <int>();
            deque2 = deque1.Clone();
            deque3 = (Deque <int>)(((ICloneable)deque1).Clone());
            deque4 = new Deque <int>(deque1);
            InterfaceTests.TestListGeneric <int>(deque2, new int[0], null);
            InterfaceTests.TestListGeneric <int>(deque3, new int[0], null);
            InterfaceTests.TestListGeneric <int>(deque4, new int[0], null);
            deque1.Add(5);
            InterfaceTests.TestListGeneric <int>(deque2, new int[0], null);
            InterfaceTests.TestListGeneric <int>(deque3, new int[0], null);
            InterfaceTests.TestListGeneric <int>(deque4, new int[0], null);

            int[] array = new int[100];
            for (int i = 0; i < 100; ++i)
            {
                array[i] = i;
            }
            deque1.Clear();
            for (int i = 63; i < 100; ++i)
            {
                deque1.AddToBack(i);
            }
            for (int i = 62; i >= 0; --i)
            {
                deque1.AddToFront(i);
            }
            deque2 = deque1.Clone();
            deque3 = (Deque <int>)(((ICloneable)deque1).Clone());
            deque4 = new Deque <int>(deque1);
            InterfaceTests.TestListGeneric <int>(deque2, array, null);
            InterfaceTests.TestListGeneric <int>(deque3, array, null);
            InterfaceTests.TestListGeneric <int>(deque4, array, null);
            deque4.Clear();
            InterfaceTests.TestListGeneric <int>(deque1, array, null);
            InterfaceTests.TestListGeneric <int>(deque2, array, null);
            InterfaceTests.TestListGeneric <int>(deque3, array, null);
        }
Beispiel #4
0
        public void IndexerGetReversedLargeTest()
        {
            const int repetition  = 10000;
            var       array       = new Deque <int>();
            var       reverseView = DequeTest.GetReverseView(array);

            for (int i = 0; i < repetition; i++)
            {
                array.Add(i);
            }
            Assert.AreEqual(0, reverseView[repetition - 1]);
            Assert.AreEqual(repetition - 1, reverseView[0]);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                var temp = reverseView[-1];
            });
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                var temp = reverseView[repetition];
            });
        }
Beispiel #5
0
        public void Insert_Reverse_KliberExample()
        {
            var d = new Deque <int>();
            var l = new List <int>();

            for (int i = 0; i < 1000; i++)
            {
                d.Add(i);
                l.Add(i);
                Assert.IsTrue(ForEachEqual(d, l));
            }
            for (int i = 1000; i >= 0; i--)
            {
                d.Insert(i, i);
                l.Insert(i, i);
                Assert.IsTrue(ForEachEqual(d, l));
                d.Reverse();
                l.Reverse();
                Assert.IsTrue(ForEachEqual(d, l)); //deq gets  reversed the other way than list why?
            }
        }
Beispiel #6
0
        public void SelfEqualityLargeTest()
        {
            const int repetition = 10000;
            var       array      = new Deque <int>();

            for (int i = 0; i < repetition; i++)
            {
                array.Add(i);
            }
            int k = 0;

            foreach (var item in array)
            {
                Assert.AreEqual(item, array[k++]);
            }
            k = 0;
            foreach (var item in array)
            {
                Assert.AreEqual(item, k++);
            }
        }
Beispiel #7
0
        private static bool IsInSmallRingSize(IAtom atom, int size)
        {
            var mol    = atom.Container;
            var distTo = new int[mol.Atoms.Count];

            Arrays.Fill(distTo, 1 + distTo.Length);
            distTo[atom.Index] = 0;
            var queue = new Deque <IAtom>();

            queue.Push(atom);
            int smallest = 1 + distTo.Length;

            while (queue.Any())
            {
                var a    = queue.Poll();
                int dist = 1 + distTo[a.Index];
                foreach (var b in a.Bonds)
                {
                    var nbr = b.GetOther(a);
                    if (dist < distTo[nbr.Index])
                    {
                        distTo[nbr.Index] = dist;
                        queue.Add(nbr);
                    }
                    else if (dist != 2 + distTo[nbr.Index])
                    {
                        int tmp = dist + distTo[nbr.Index];
                        if (tmp < smallest)
                        {
                            smallest = tmp;
                        }
                    }
                }
                if (2 * dist > 1 + size)
                {
                    break;
                }
            }
            return(smallest == size);
        }
Beispiel #8
0
        public void TestRemoveAt()
        {
            Deque<int> test = new Deque<int>(6);
            test.Add(0);
            test.Add(1);
            test.Add(2);
            test.Add(3);
            test.Add(4);
            test.Add(5);

            test.PopFront();
            test.PopFront();

            test.Add(6);
            test.Add(7);

            test.RemoveAt(2);

            int[] arr = test.ToArray();

            CollectionAssert.AreEqual(arr, new int[] { 2, 3, 5, 6, 7 });
            Assert.AreEqual(test.Count, 5);
        }
Beispiel #9
0
        public void IndexerSetLargeTest()
        {
            const int repetition = 10000;
            var       array      = new Deque <int>();

            for (int i = 0; i < repetition; i++)
            {
                array.Add(1);
            }
            array[0] = 3;
            array[repetition - 1] = 2;
            Assert.AreEqual(2, array[repetition - 1]);
            Assert.AreEqual(3, array[0]);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                array[-1] = 42;
            });
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                array[repetition] = 42;
            });
        }
Beispiel #10
0
        public void Deque_Add_BackExtension()
        {
            List <int> coll = new List <int>()
            {
                4, 5, 8, 10, 2, 5, 6, 7
            };
            Deque <int> deque = new Deque <int>(coll);           //tests add

            coll.Add(5);
            deque.Add(5);

            Assert.AreEqual(coll.Count, deque.Count);


            int index = 0;

            foreach (int a in deque)
            {
                Assert.AreEqual(coll[index], a);
                ++index;
            }
        }
Beispiel #11
0
        public void RemoveAtBig()
        {
            var d = new Deque <int>();
            var l = new List <int>();


            Random rnd = new Random();

            for (int i = 0; i < 10000; i++)
            {
                d.Add(i);
                l.Add(i);
            }

            for (int i = 0; i < 10000; i++)
            {
                int ind = rnd.Next(0, 10000 - i);
                d.RemoveAt(ind);
                l.RemoveAt(ind);
                Assert.IsTrue(ForEachEqual(d, l));
            }
        }
Beispiel #12
0
        public void Deque_ExtendRight_thenLeft()
        {
            List <int>  coll  = new List <int>();
            Deque <int> deque = new Deque <int>();       //tests add

            for (int i = 0; i < 3 * 56; i++)             //see default sizes; might have changed
            {
                coll.Add(i);
                deque.Add(i);
            }

            deque.PushFront(50);
            coll.Insert(0, 50);

            int index = 0;

            foreach (int a in deque)
            {
                Assert.AreEqual(coll[index], a);
                ++index;
            }
        }
Beispiel #13
0
        public void ReadOnlyReversedTest()
        {
            const int repetition  = 40;
            var       array       = new Deque <int>();
            var       reverseView = DequeTest.GetReverseView(array);

            for (int i = 0; i < repetition; i++)
            {
                array.Add(i);
            }
            Assert.AreEqual(false, reverseView.IsReadOnly);
            foreach (int s in array)
            {
                Assert.AreEqual(true, reverseView.IsReadOnly);
            }
            Assert.AreEqual(false, reverseView.IsReadOnly);
            foreach (int s in reverseView)
            {
                Assert.AreEqual(true, array.IsReadOnly);
            }
            Assert.AreEqual(false, array.IsReadOnly);
        }
Beispiel #14
0
        public void TestRemoveAt()
        {
            Deque <int> test = new Deque <int>(6);

            test.Add(0);
            test.Add(1);
            test.Add(2);
            test.Add(3);
            test.Add(4);
            test.Add(5);

            test.PopFront();
            test.PopFront();

            test.Add(6);
            test.Add(7);

            test.RemoveAt(2);

            int[] arr = test.ToArray();

            CollectionAssert.AreEqual(arr, new int[] { 2, 3, 5, 6, 7 });
            Assert.AreEqual(test.Count, 5);
        }
Beispiel #15
0
        public void TestBulkAdd()
        {
            int         loops = 10000;
            Deque <int> deque = new Deque <int>();

            for (int i = 1; i < loops; i++)
            {
                deque.Add(i);
            }

            deque.AddFront(0);

            Deque <int> dequeCopy = new Deque <int>(deque);

            for (int expected = 0; expected < loops; expected++)
            {
                int actual     = deque.RemoveFront();
                int actualCopy = dequeCopy[expected];

                Assert.AreEqual(expected, actual, "Original deque item differs from expected value");
                Assert.AreEqual(expected, actualCopy, "Copied deque item differs from expected value");
            }
        }
Beispiel #16
0
        public void CopyToTestExceptions()
        {
            var array = new Deque <int>();

            for (int i = 0; i < 100; i++)
            {
                array.Add(i);
            }
            int[] newarray = null;
            Assert.ThrowsException <ArgumentNullException>(() =>
            {
                array.CopyTo(newarray, 25);
            });
            newarray = new int[200];
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                array.CopyTo(newarray, -1);
            });
            Assert.ThrowsException <ArgumentException>(() =>
            {
                array.CopyTo(newarray, 190);
            });
        }
Beispiel #17
0
        public void IndexerSetReversedLargeTest()
        {
            const int repetition  = 10000;
            var       array       = new Deque <int>();
            var       reverseView = DequeTest.GetReverseView(array);

            for (int i = 0; i < repetition; i++)
            {
                array.Add(1);
            }
            reverseView[0] = 3;
            reverseView[repetition - 1] = 2;
            Assert.AreEqual(2, reverseView[repetition - 1]);
            Assert.AreEqual(3, reverseView[0]);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                reverseView[-1] = 42;
            });
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                reverseView[repetition] = 42;
            });
        }
Beispiel #18
0
        public void ProcessJoin(
            ISet<MultiKeyArrayOfKeys<EventBean>> newEvents,
            ISet<MultiKeyArrayOfKeys<EventBean>> oldEvents)
        {
            if (!processor.HasHavingClause) {
                AddToJoin(newEvents, oldEvents);
                return;
            }

            if (newEvents != null && newEvents.Count > 0) {
                foreach (var theEvent in newEvents) {
                    var passesHaving = processor.EvaluateHavingClause(
                        theEvent.Array,
                        true,
                        processor.GetAgentInstanceContext());
                    if (!passesHaving) {
                        continue;
                    }

                    eventsNewJoin.Add(theEvent);
                }
            }

            if (oldEvents != null && oldEvents.Count > 0) {
                foreach (var theEvent in oldEvents) {
                    var passesHaving = processor.EvaluateHavingClause(
                        theEvent.Array,
                        false,
                        processor.GetAgentInstanceContext());
                    if (!passesHaving) {
                        continue;
                    }

                    eventsOldJoin.Add(theEvent);
                }
            }
        }
Beispiel #19
0
        public void EnumChange16_IndexerGet()
        {
            Deque <string> someNames = new Deque <string>();

            someNames.Add("Bill");
            someNames.Add("Mike");
            someNames.Add("Alice");
            someNames.Add("Trevor");
            someNames.Add("Scott");
            string a;

            foreach (string s in someNames)
            {
                if (s.StartsWith("A"))
                {
                    a = someNames[0];
                }
            }
            someNames.Add("Help");
        }
Beispiel #20
0
        public void EnumChange15_GetReverse()
        {
            Deque <string> someNames = new Deque <string>();

            someNames.Add("Bill");
            someNames.Add("Mike");
            someNames.Add("Alice");
            someNames.Add("Trevor");
            someNames.Add("Scott");
            IList <string> a;

            foreach (string s in someNames)
            {
                if (s.StartsWith("A"))
                {
                    a = DequeTest.GetReverseView(someNames);
                }
            }
            someNames.Add("Help");
        }
Beispiel #21
0
        public void TestAdd()
        {
            Deque <int> deque = new Deque <int>();

            Assert.IsTrue(deque.IsEmpty);

            int item = 1;

            Assert.IsFalse(deque.Contains(item));
            deque.Add(item);

            int actualBack;

            actualBack = deque[0];

            Assert.IsTrue(deque.Contains(item));
            Assert.AreEqual(item, actualBack);

            int itemNewBack = 2;

            Assert.IsFalse(deque.Contains(itemNewBack));
            deque.AddBack(itemNewBack);

            Assert.IsTrue(deque.Contains(itemNewBack));
            actualBack = deque[1];
            Assert.AreEqual(itemNewBack, actualBack);

            actualBack = deque.RemoveBack();
            Assert.AreEqual(itemNewBack, actualBack);

            int itemNewFront = -1;

            Assert.IsFalse(deque.Contains(itemNewFront));
            deque.AddFront(itemNewFront);

            int actualFront;

            Assert.IsTrue(deque.Contains(itemNewFront));

            actualFront = deque[0];
            Assert.AreEqual(itemNewFront, actualFront);

            actualFront = deque.RemoveFront();
            Assert.AreEqual(itemNewFront, actualFront);

            int[] itemRange = new[] { 3, 4, 5, 6 };
            int   offset    = deque.Count;

            deque.AddRange(itemRange);

            foreach (var itm in itemRange)
            {
                Assert.AreEqual(itm, deque[offset]);
                offset++;
            }

            int[] itemBackRange = new[] { 7, 8, 9, 10 };
            offset = deque.Count;
            deque.AddBackRange(itemBackRange);
            foreach (var itm in itemBackRange)
            {
                Assert.AreEqual(itm, deque[offset]);
                offset++;
            }

            int[] itemFrontRange = new[] { 3, 4, 5, 6 };
            deque.AddFrontRange(itemFrontRange);

            for (int i = 0; i < itemFrontRange.Length; i++)
            {
                var itm = itemFrontRange[i];
                Assert.AreEqual(itm, deque[i]);
            }
        }
Beispiel #22
0
        public void TestBulkAdd()
        {
            int loops = 10000;
            Deque<int> deque = new Deque<int>();
            for (int i = 1; i < loops; i++)
            {
                deque.Add(i);
            }

            deque.AddFront(0);

            Deque<int> dequeCopy = new Deque<int>(deque);

            for (int expected = 0; expected < loops; expected++)
            {
                int actual = deque.RemoveFront();
                int actualCopy = dequeCopy[expected];

                Assert.AreEqual(expected, actual, "Original deque item differs from expected value");
                Assert.AreEqual(expected, actualCopy, "Copied deque item differs from expected value");
            }
        }
Beispiel #23
0
        /// <summary>
        /// Internal method, MMFF primary charges. Tabulated (MMFFFORMCHG.PAR) and
        /// variable (assigned in code).
        /// </summary>
        /// <param name="mol">molecule</param>
        /// <param name="adjList">adjacency list representation</param>
        /// <param name="edgeMap">edge to bond mapping</param>
        private void PrimaryCharges(IAtomContainer mol, int[][] adjList, EdgeToBondMap edgeMap)
        {
            for (int v = 0; v < mol.Atoms.Count; v++)
            {
                var atom     = mol.Atoms[v];
                var symbType = atom.AtomTypeName;
                var fc       = mmffParamSet.GetFormalCharge(symbType);

                atom.Charge = 0d;

                if (fc != null)
                {
                    atom.Charge = (double)fc;
                }
                else
                {
                    // charge sharing between equivalent terminal oxygens
                    switch (symbType)
                    {
                    case "O2S":
                    case "O3S":
                    case "O2P":
                    case "O3P":
                    case "O4P":
                    {
                        // already handled
                        if (atom.Charge != 0)
                        {
                            continue;
                        }

                        // find the central atom (S or P)
                        int focus = -1;
                        foreach (var w in adjList[v])
                        {
                            int elem = mol.Atoms[w].AtomicNumber;
                            if (elem == AtomicNumbers.Sulfur || elem == AtomicNumbers.Phosphorus)
                            {
                                if (focus >= 0)
                                {
                                    focus = -2;
                                    break;
                                }
                                focus = w;
                            }
                        }

                        // log - multiple or unfound focus
                        if (focus < 0)
                        {
                            continue;
                        }

                        // ensure [P+]-[O-] vs P=O are same by including the charge from
                        // the focus
                        double qSum  = FCharge(mol.Atoms[focus]);
                        int    nTerm = 0;

                        foreach (var w in adjList[focus])
                        {
                            if (mol.Atoms[w].AtomTypeName.Equals(symbType, StringComparison.Ordinal))
                            {
                                qSum += FCharge(mol.Atoms[w]);
                                nTerm++;
                            }
                        }
                        double qSplt = qSum / nTerm;

                        foreach (var w in adjList[focus])
                        {
                            if (mol.Atoms[w].AtomTypeName.Equals(symbType, StringComparison.Ordinal))
                            {
                                atom.Charge = qSplt;
                            }
                        }
                    }
                    break;

                    case "N5M":
                        // charge sharing between nitrogen anions
                    {
                        if (atom.Charge != 0)
                        {
                            continue;
                        }

                        var eqiv  = new HashSet <IAtom>();
                        var visit = new HashSet <int>();
                        var queue = new Deque <int> {
                            v
                        };

                        while (queue.Count != 0)
                        {
                            int w = queue.Poll();
                            visit.Add(w);

                            if (string.Equals(mol.Atoms[w].AtomTypeName, "N5M", StringComparison.Ordinal))
                            {
                                eqiv.Add(mol.Atoms[w]);
                            }

                            foreach (var u in adjList[w])
                            {
                                var bond = edgeMap[w, u];
                                if (bond.GetProperty(MMFF_AROM, false) && !visit.Contains(u))
                                {
                                    queue.Add(u);
                                }
                            }
                        }

                        double q = 0;
                        foreach (var eqivAtom in eqiv)
                        {
                            q += FCharge(eqivAtom);
                        }
                        q /= eqiv.Count;
                        foreach (var eqivAtom in eqiv)
                        {
                            eqivAtom.Charge = q;
                        }
                    }
                    break;
                    }
                }
            }
        }
Beispiel #24
0
        public void TestAdd()
        {
            Deque<int> deque = new Deque<int>();

            Assert.IsTrue(deque.IsEmpty);

            int item = 1;

            Assert.IsFalse(deque.Contains(item));
            deque.Add(item);

            int actualBack;
            actualBack = deque[0];

            Assert.IsTrue(deque.Contains(item));
            Assert.AreEqual(item, actualBack);

            int itemNewBack = 2;
            Assert.IsFalse(deque.Contains(itemNewBack));
            deque.AddBack(itemNewBack);

            Assert.IsTrue(deque.Contains(itemNewBack));
            actualBack = deque[1];
            Assert.AreEqual(itemNewBack, actualBack);

            actualBack = deque.RemoveBack();
            Assert.AreEqual(itemNewBack, actualBack);

            int itemNewFront = -1;
            Assert.IsFalse(deque.Contains(itemNewFront));
            deque.AddFront(itemNewFront);

            int actualFront;
            Assert.IsTrue(deque.Contains(itemNewFront));

            actualFront = deque[0];
            Assert.AreEqual(itemNewFront, actualFront);

            actualFront = deque.RemoveFront();
            Assert.AreEqual(itemNewFront, actualFront);

            int[] itemRange = new[] { 3, 4, 5, 6 };
            int offset = deque.Count;
            deque.AddRange(itemRange);

            foreach (var itm in itemRange)
            {
                Assert.AreEqual(itm, deque[offset]);
                offset++;
            }

            int[] itemBackRange = new[] { 7, 8, 9, 10 };
            offset = deque.Count;
            deque.AddBackRange(itemBackRange);
            foreach (var itm in itemBackRange)
            {
                Assert.AreEqual(itm, deque[offset]);
                offset++;
            }

            int[] itemFrontRange = new[] { 3, 4, 5, 6 };
            deque.AddFrontRange(itemFrontRange);

            for (int i = 0; i < itemFrontRange.Length; i++)
            {
                var itm = itemFrontRange[i];
                Assert.AreEqual(itm, deque[i]);
            }
        }
Beispiel #25
0
        public void EnumExceptionsTest()
        {
            var array = new Deque <int> {
                0, 1, 2, 3, 4, 5
            };

            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    array.Add(42);
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    array.Clear();
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    array.Insert(0, 42);
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    array.Remove(42);
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    array.RemoveAt(0);
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    array.Reverse();
                }
            });
            var reverseView = DequeTest.GetReverseView(array);

            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    reverseView.Add(42);
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    reverseView.Clear();
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    reverseView.Insert(0, 42);
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    reverseView.Remove(42);
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    reverseView.RemoveAt(0);
                }
            });
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                foreach (var item in array)
                {
                    reverseView.Reverse();
                }
            });
        }
Beispiel #26
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (IPointerOverUI.Instance.IsPointerOverUIObject())
            {
                return;
            }
            curr = Input.mousePosition;
        }
        if (Input.GetMouseButtonUp(0))
        {
            Vector3 cuurent = Input.mousePosition;
            float currDis = Vector3.Distance(curr,cuurent);
            if (currDis>distanceOffset)
            {
                return;
            }
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.collider.gameObject.CompareTag("Finish") || hit.collider.gameObject.CompareTag("Fe")) //地面,铁丝网可点击
                {
                    short gridX, gridY;
                    if (getDestination(hit.point, out gridX, out gridY))
                    {
                        IList<SpriteSoldier> list = new Deque<SpriteSoldier>();
                        bool oneSoldierType = true;
                        for (int i = 0; i < soilders.Count; i++)
                        {
                            SpriteSoldier sn = soilders[i];
                            if (!sn.soldier.isSelected || sn.soldier.destination.x == gridX && sn.soldier.destination.y == gridY)
                            {
                                continue;
                            }
                            if (oneSoldierType && i + 1 < soilders.Count)
                            {
                                SpriteSoldier ss = soilders[i + 1];
                                if (ss.soldier.isSelected && sn.soldier.type != ss.soldier.type)
                                    oneSoldierType = false;
                            }

                            sn.soldier.destination.x = gridX;
                            sn.soldier.destination.y = gridY;
                            sn.soldier._target.x = hit.point.x;
                            sn.soldier._target.y = hit.point.z;

                            list.Add(soilders[i]);
                        }
                        StartCoroutine(startFindPath(list, oneSoldierType));
                    }
                }
            }
        }
    }