Ejemplo n.º 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());
            }
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
            }
        }