Exemplo n.º 1
0
        public override void Run(string part)
        {
            var instructions = FileReader.ReadFile(2016, 2);
            var numPad       = new NumPadManager(part);

            numPad.OutputCurrentPosition();
            foreach (string row in instructions.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
            {
                foreach (char letter in row.ToList())
                {
                    Console.WriteLine(String.Format("Input Received is {0}", letter));
                    switch (letter)
                    {
                    case 'U':
                        numPad.MoveUp();
                        break;

                    case 'D':
                        numPad.MoveDown();
                        break;

                    case 'L':
                        numPad.MoveLeft();
                        break;

                    case 'R':
                        numPad.MoveRight();
                        break;
                    }
                    numPad.OutputCurrentPosition();
                }
                numPad.SaveFinalPosition();
            }
        }
 // Use this for initialization
 void Start()
 {
     inputField    = GetComponent <InputField>();
     numPadManager = GameObject.FindGameObjectWithTag("NumPadManager")
                     .GetComponent <NumPadManager>();
 }