コード例 #1
0
ファイル: TileTests.cs プロジェクト: lumley/EscapeTheMaze
        public void BindNeighboursShouldOverrideNeighbourWhenAlreadySet()
        {
            Tile newNeighbour = new Tile();
            Direction directionFromTileToNeighbour = Direction.NORTH;

            this.tile.BindNeighbours(neighbour, directionFromTileToNeighbour);

            Assert.AreEqual(this.neighbour, this.tile.GetNeighbour(directionFromTileToNeighbour));

            this.tile.BindNeighbours(newNeighbour, directionFromTileToNeighbour);
            Assert.AreEqual(newNeighbour, this.tile.GetNeighbour(directionFromTileToNeighbour));
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: chenaho/Unity3d_3M
        private void InitialiseGameBoard()
        {
            GameBoard = new Tile[Width, Height];

            for (var x = 0; x < Width; x++)
            {
                for (var y = 0; y < Height; y++)
                {
                    GameBoard[x, y] = new Tile(x, y);
                }
            }

            AllTiles.ToList().ForEach(o => o.FindNeighbours(GameBoard));
        }
コード例 #3
0
ファイル: Map.cs プロジェクト: ribeirofelix/IntArtificial
        /* Reads a 42 x 42 map from a text file.
         *
         * Parameter: mapFile - name of a text file
         */
        private void ReadMap(string mapFile)
        {
            StreamReader st = null;

            /* Try to open a text file */
            try
            {
                st = new System.IO.StreamReader(mapFile);
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }

            /* Read each line of a text file that defines a map. */
            for (int j = 0; j < 42; j++)
            {
                /* Read line */
                string line = st.ReadLine();
                _map[j] = new Tile[MAXTILES];
                /* Creates tiles */
                for (int k = 0; k < line.Length; k++)
                {
                    _map[j][k] = new Tile(line[k] , j, k , this);
                    Helper.PutGround(j, k, line[k]);

                }
            }

            /* Close files */
            st.Close();
        }
コード例 #4
0
        public TileImage(Tile tl, int x , int y)
        {
            this.Width = prop;
            this.Height = prop;
            this.Location = new Point(x, y);
            this.tile = tl;
            this.tile.listUpdView += UpdateTile;

            InitLayout();
        }
コード例 #5
0
ファイル: TileTests.cs プロジェクト: lumley/EscapeTheMaze
 public void SetUp()
 {
     this.tile = new Tile();
     this.neighbour = new Tile();
 }