コード例 #1
0
        private void AddTileInfoToDisplayedTiles(DroidReportStatusEventArgs args)
        {
            int x = args.Position[0];
            int y = args.Position[1];

            foreach (ITile t in args.TileInfo.N)
            {
                DisplayedTiles[--y, x] = t.JunctionType.ToString();
            }
            y = args.Position[1];
            foreach (ITile t in args.TileInfo.S)
            {
                DisplayedTiles[++y, x] = t.JunctionType.ToString();
            }
            y = args.Position[1];
            foreach (ITile t in args.TileInfo.E)
            {
                DisplayedTiles[y, ++x] = t.JunctionType.ToString();
            }
            x = args.Position[0];
            foreach (ITile t in args.TileInfo.W)
            {
                DisplayedTiles[y, --x] = t.JunctionType.ToString();
            }
        }
コード例 #2
0
        public void OnDroidReportedStatus(object source, DroidReportStatusEventArgs args)
        {
            Console.WriteLine($"droid {args.ID} reported position ({string.Join(';', args.Position)}) facing {args.Direction} ");
            CurrentDroidReports.Add(args);
            DisplayedTiles[args.Position[1], args.Position[0]] = args.Direction.ToString();

            AddTileInfoToDisplayedTiles(args);

            OutputManagerUpdated(this, EventArgs.Empty);
        }