コード例 #1
0
ファイル: CompilerHints.cs プロジェクト: mhaque3/soa_unity
        /**
         *      Call this method if you use a FlatRhombGrid.
         *      Replace	the type __CellType to whatever type you have in your grid.
         *
         *      You can call the method anywhere in your code.
         *
         *              if(!__CompilerHint__FlatRhomb()) return;
         *
         *      This methods always returns true.
         *
         *      @since 1.6
         */
        public static bool __CompilerHint__FlatRhomb()
        {
            //Ensures abstract super classes for base grids gets created
            var grid = new FlatHexGrid <__CellType[]>(1, 1);

            foreach (var point in grid)
            {
                grid[point] = new __CellType[1];
            }

            //Ensures shape infpo classes get created
            var shapeStorageInfo = new ShapeStorageInfo <FlatRhombPoint>(new IntRect(), p => true);
            var shapeInfo        = new FlatRhombShapeInfo <__CellType>(shapeStorageInfo);

            return(grid[grid.First()][0] == null || shapeInfo.IncIndex(0) != null);
        }
コード例 #2
0
        public static bool __CompilerHint__FlatRhomb__MeshTileCell()
        {
            var grid1 = new FlatHexGrid <MeshTileCell[]>(1, 1);

            foreach (var point in grid1)
            {
                grid1[point] = new MeshTileCell[1];
            }

            var grid2 = new FlatRhombGrid <MeshTileCell>(1, 1);

            foreach (var point in grid2)
            {
                grid2[point] = null;
            }

            var shapeStorageInfo = new ShapeStorageInfo <FlatRhombPoint>(new IntRect(), p => true);
            var shapeInfo        = new FlatRhombShapeInfo <MeshTileCell>(shapeStorageInfo);

            return(grid1[grid1.First()][0] == null || grid2[grid2.First()] == null || shapeInfo.IncIndex(0) != null);
        }