예제 #1
0
        public int MoveService(DrawObject client,GraphicsList GList,Point Goal)
        {
            client.PretendToMoveStart(Goal.X, Goal.Y);
            foreach (DrawObject o in GList.graphicsList)
            {
                if (o == client)
                {
                    continue;

                }
                else
                {   //judge the point?if line judge point, if rectangle?
                    //we have two point list
                    ArrayList clientpoints = client.GetCriticalPointList();
                    ArrayList Servicepoints = o.GetCriticalPointList();

                    for (int i = 0; i < clientpoints.Count; i++)
                    {
                        for(int j=0;j<Servicepoints.Count;j++)
                        {
                            int result = JudgeVertical(((Point)clientpoints[i]), ((Point)Servicepoints[j]));
                            if (result>0)
                            {

                                client.PretendToMoveOver(Goal.X, Goal.Y);

                                if (result == 1)
                                {
                                    client.Move(((Point)Servicepoints[j]).X, Goal.Y);
                                    return 1;

                                }
                                else if (result == 2)
                                {
                                    client.Move(Goal.X, ((Point)Servicepoints[j]).Y);
                                    return 1;

                                }
                                else
                                {

                                }

                            }

                        }

                    }

                }

            }
            client.PretendToMoveOver(Goal.X, Goal.Y);
            //every object has his own relation algrithum critical point
            //otherobject
            //if havent relation
            client.Move(Goal.X, Goal.Y);
            //client origin move(Goal)
            //if haverelation
            //
            return 1;
        }