コード例 #1
0
        public static byte NeighborhoodToAutoTileValue(TileNeighborhood n, HashSet <uint> a, TileType b)
        {
            int toret = 0;

            toret += (n.northwest == b && a.Contains(n.north.typeID) && a.Contains(n.west.typeID)) ? 1 : 0;
            toret += (n.north == b) ? 2 : 0;
            toret += (n.northeast == b && a.Contains(n.north.typeID) && a.Contains(n.east.typeID)) ? 4 : 0;

            toret += (n.west == b) ? 8 : 0;
            toret += (n.east == b) ? 16 : 0;

            toret += (n.southwest == b && a.Contains(n.south.typeID) && a.Contains(n.west.typeID)) ? 32 : 0;
            toret += (n.south == b) ? 64 : 0;
            toret += (n.southeast == b && a.Contains(n.south.typeID) && a.Contains(n.east.typeID)) ? 128 : 0;

            return((byte)toret);
        }
コード例 #2
0
        public static byte NeighborhoodToAutoTileValue(TileNeighborhood n, TileType a, TileType b)
        {
            int toret = 0;

            toret += (n.northwest == b && n.north == a && n.west == a) ? 1 : 0;
            toret += (n.north == b) ? 2 : 0;
            toret += (n.northeast == b && n.north == a && n.east == a) ? 4 : 0;

            toret += (n.west == b) ? 8 : 0;
            toret += (n.east == b) ? 16 : 0;

            toret += (n.southwest == b && n.south == a && n.west == a) ? 32 : 0;
            toret += (n.south == b) ? 64 : 0;
            toret += (n.southeast == b && n.south == a && n.east == a) ? 128 : 0;

            return((byte)toret);
        }