示例#1
0
        /// <summary>
        /// Start task method
        /// </summary>
        /// <param name="r"></param>
        public void StartTask(Robot r)
        {
            r.ClearSuitcase();

            if (placeAtHome)
            {
                suitcase.Move(home.GetX(), home.GetY(), home.GetZ() - 2.3);
            }
            else
            {
                suitcase.Move(home.GetX(), home.GetY(), home.GetZ());
            }
        }
示例#2
0
        /// <summary>
        /// Completes the task
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public bool TaskComplete(Airplane a)
        {
            bool Complete = Math.Round(a.x, 1) == Math.Round(destination.GetX(), 1) && Math.Round(a.z, 1) == Math.Round(destination.GetZ(), 1);

            if (Complete && liftOff && Flying)
            {
                a.Move(-152.5, 54.3, -15);
            }
            // Trigger robots when on point 2 (home)
            if (Complete && !liftOff && !Flying)
            {
                a.SetLanded(true);
            }
            return(Complete);
        }
示例#3
0
        /// <summary>
        /// Task complete method
        /// </summary>
        /// <param name="r"></param>
        /// <returns></returns>
        public bool TaskComplete(Robot r)
        {
            bool complete = (suitcase.x == r.x && suitcase.y == r.y + 0.3 && suitcase.z == r.z);

            if (complete)
            {
                walkingHome = false;
                if (bringHome)
                {
                    suitcase.x = home.GetX();
                    suitcase.y = home.GetY();
                    suitcase.z = home.GetZ();
                }
            }
            return(complete);
        }
示例#4
0
        /// <summary>
        /// Change direction
        /// </summary>
        /// <param name="coordinateToGo"></param>
        private void ChangeDirection(Coordinate coordinateToGo)
        {
            double degrees90  = Math.PI / 2;
            double degrees180 = Math.PI;

            if ((Math.Round(coordinateToGo.GetX(), 1) > Math.Round(this.x, 1) || Math.Round(coordinateToGo.GetX(), 1) < Math.Round(this.x, 1)) && !xRotated)
            {
                this.Rotate(0, degrees90, 0);
                xRotated = true;
                zRotated = false;
            }
            else if ((Math.Round(coordinateToGo.GetZ(), 1) > Math.Round(this.z, 1) || Math.Round(coordinateToGo.GetZ(), 1) < Math.Round(this.z, 1)) && !zRotated)
            {
                this.Rotate(0, degrees180, 0);
                zRotated = true;
                xRotated = false;
            }
        }
示例#5
0
        /// <summary>
        /// Place suitcases in the world
        /// </summary>
        /// <param name="coordinates"></param>
        private void PlaceSuitcases(List <Coordinate> coordinates)
        {
            foreach (Coordinate c in coordinates)
            {
                if (c.CanBeOccupied())
                {
                    occupationList.Add(c);
                }
            }

            int    totalSuitcases = 8;
            Random rnd            = new Random();

            for (int i = 0; i < totalSuitcases; i++)
            {
                int        r = rnd.Next(occupationList.Count);
                Coordinate c = occupationList[r];
                c.GiveSuitcase(CreateSuitcase(c.GetX(), c.GetY(), c.GetZ()));
                occupationList.RemoveAt(r);
            }
        }
示例#6
0
 /// <summary>
 /// Task complete method
 /// </summary>
 /// <param name="r"></param>
 /// <returns></returns>
 public bool TaskComplete(Robot r)
 {
     return(Math.Round(r.x, 1) == Math.Round(destination.GetX(), 1) && Math.Round(r.z, 1) == Math.Round(destination.GetZ(), 1));
 }