示例#1
0
        /// <summary>
        /// State in which Justina search for a marker/paddle located in front of her
        /// </summary>
        /// <param name="currentState"></param>
        /// <param name="o"></param>
        /// <returns>MarkerFound if a marker/paddle was found, MarkerNotFound elsewhere</returns>
        private int SearchMarker(int currentState, object o)
        {
            if (searchAttempt == 0)
            {
                TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000.-> SearchMarker state reached.");
            }

            //trying to execute the findmarker command
            if (cmdMan.OBJ_FNDT_findpaddle(out SMConfiguration.markerCommand, 10000))
            {
                //findmarker command executed succesfully
                if (SMConfiguration.markerCommand == "")  //check if a marker was found
                {
                    SMConfiguration.markerFound = false;  //marker not found
                }
                else
                {
                    SMConfiguration.markerFound = true;   //marker found
                }
            }

            searchAttempt++;

            //jump to the next state
            if (SMConfiguration.markerFound)
            {
                return((int)States.MarkerFound);
            }
            else
            {
                return((int)States.MarkerNotFound);
            }
        }