예제 #1
0
        protected override void OnComplete()
        {
            MessagesOut msg = null;

            if (instructions.Count > 0)
            {
                if (lastInstruction != null)
                {
                    pathFinding.SetShitBotPosition(lastInstruction[1], lastInstruction[2]);
                    pathFinding.Rotation = lastInstruction[3];
                }

                Console.WriteLine(instructions[0][0]);

                switch (instructions[0][0])
                {
                case 0:
                    msg = new Msg_Out_Left();
                    break;

                case 1:
                    msg = new Msg_Out_Right();
                    break;

                case 2:
                    msg = new Msg_Out_Forward();
                    break;
                }

                if (msg != null)
                {
                    shittyNetClient.SendMessage(msg);
                }

                lastInstruction = instructions[0];
                instructions.RemoveAt(0);

                Console.WriteLine("count : " + instructions.Count);

                if (msg == null)
                {
                    OnComplete();
                }
            }
            else if (lastInstruction != null)
            {
                pathFinding.SetShitBotPosition(lastInstruction[1], lastInstruction[2]);
                pathFinding.Rotation = lastInstruction[3];
                Console.WriteLine(lastInstruction[3]);
                pathFinding.Reset();
                lastInstruction = null;
            }
            else
            {
                lastInstruction = null;
            }
        }
예제 #2
0
 public void SendMessage(MessagesOut msg)
 {
     try
     {
         msg.SendMessage(stream);
     }
     catch (Exception e)
     {
     }
 }