Exemplo n.º 1
0
        public void TestEquals()
        {
            var r = CornerTileSelectionKey.ValueOf(Direction.Up, false, false, false);
            var l = CornerTileSelectionKey.ValueOf(Direction.Left, false, false, false);

            r.Equals(l).Should().BeFalse();
        }
Exemplo n.º 2
0
        /// Arrange the tile for each bit combination in a 2x2 square
        /// and place each tile in a clock wise fashion based on the
        /// direction (U, L, D, R)
        ///
        /// There are 8 different bit combinations (identified by 'idx'),
        /// arranged in two lines. Therefore there are 16 x 8 tiles in
        /// the grid.
        void Add(Dictionary <CornerTileSelectionKey, IntPoint> k, int idx)
        {
            var baseX = (idx % 4) * 2;
            var baseY = (idx / 4) * 2;

            var b0 = (idx & 1) == 1;
            var b1 = (idx & 2) == 2;
            var b2 = (idx & 4) == 4;

            k.Add(CornerTileSelectionKey.ValueOf(Direction.Up, b0, b1, b2), new IntPoint(baseX, baseY));
            k.Add(CornerTileSelectionKey.ValueOf(Direction.Right, b0, b1, b2), new IntPoint(baseX + 1, baseY));
            k.Add(CornerTileSelectionKey.ValueOf(Direction.Down, b0, b1, b2), new IntPoint(baseX + 1, baseY + 1));
            k.Add(CornerTileSelectionKey.ValueOf(Direction.Left, b0, b1, b2), new IntPoint(baseX, baseY + 1));
        }
Exemplo n.º 3
0
        public bool TryFind(string tag, CornerTileSelectionKey selector, out TRenderTile tile)
        {
            var format = suffixMapping[selector.LinearIndex];

            return(baseRegistry.TryFind(string.Format(format, tag), out tile));
        }