public string ChangeState(int index, BlockState state)
 {
     index--;
     try
     {
         pathControllerActions.ChangeState(index, state);
     }
     catch (Exception e)
     {
         return(e.Message);
     }
     if (index > 0)
     {
         index--;
         try
         {
             state = pathControllerActions.GetState(index);
             pathControllerActions.ChangeState(index, state);
         }
         catch (Exception e)
         {
             return(e.Message);
         }
         Blocks[index] = new Block(index, state);
     }
     return(null);
 }
Пример #2
0
        public void ChangeState()
        {
            int        index = reader.ReadNumber("Choose block: ", 1, pathControllerActions.GetPathLength()) - 1;
            BlockState state = reader.ReadState("Choose state: ");

            pathControllerActions.ChangeState(index, state);

            writer.WriteLine("Block state changed.");
        }