コード例 #1
0
        public Maze <Cell> CreateMazeWithMask(int x, int y, bool[,] mask)
        {
            if (mask.GetLength(0) != x || mask.GetLength(1) != y)
            {
                throw new ArgumentException("Invalid mask size");
            }

            if (currentGenerator == null)
            {
                return(null);
            }

            IMaskGenerator <Cell> maskGenerator = currentGenerator as IMaskGenerator <Cell>;

            if (maskGenerator == null)
            {
                throw new ArgumentException("Current Generator isn't a Mask Generator");
            }

            Maze <Cell> maze = new Maze <Cell>(x, y);

            for (int i = 0; i < x; i++)
            {
                for (int j = 0; j < y; j++)
                {
                    if (mask[i, j])
                    {
                        maze[i, j].Locked = true;
                    }
                }
            }

            return(maskGenerator.Generate(x, y, maze));
        }
コード例 #2
0
 public PANserver(IPANArchiveManager panArchiveManager, IMaskGenerator maskGen)
 {
     _panArchiveManager = panArchiveManager;
     _maskGen           = maskGen;
 }
コード例 #3
0
 public void SetUp()
 {
     _panArchiveManager = Substitute.For <IPANArchiveManager>();
     _maskGen           = Substitute.For <IMaskGenerator>();
 }