private void BuildGrid()
		{
			const int width = 4;
			const int height = 3;

			grid = FlatRhombGrid<SpriteCell>
				.BeginShape()
				.Rectangle(width, height)
				.EndShape();

			map = new FlatRhombMap(CellDimensions)
				.AnchorCellMiddleCenter()
				.WithWindow(ExampleUtils.ScreenRect)
				.AlignMiddleCenter(grid)
				.To3DXY()
				;

			foreach (FlatRhombPoint point in grid)
			{
				SpriteCell cell = Instantiate(cellPrefab);
				Vector3 worldPoint = map[point];

				cell.transform.parent = root.transform;
				cell.transform.localPosition = worldPoint;
				cell.transform.localScale = Vector3.one;

				cell.Color = ExampleUtils.Colors[point.GetColor12()];
				cell.name = point.ToString();
				cell.SetAngle(-360f/FlatRhombPoint.SpliceCount*point.I);

				grid[point] = cell;
			}
		}
示例#2
0
    private void BuildGrid()
    {
        const int width  = 4;
        const int height = 3;

        grid = FlatRhombGrid <SpriteCell>
               .BeginShape()
               .Rectangle(width, height)
               .EndShape();

        map = new FlatRhombMap(CellDimensions)
              .AnchorCellMiddleCenter()
              .WithWindow(ExampleUtils.ScreenRect)
              .AlignMiddleCenter(grid)
              .To3DXY()
        ;

        foreach (FlatRhombPoint point in grid)
        {
            SpriteCell cell       = Instantiate(cellPrefab);
            Vector3    worldPoint = map[point];

            cell.transform.parent        = root.transform;
            cell.transform.localPosition = worldPoint;
            cell.transform.localScale    = Vector3.one;

            cell.Color = ExampleUtils.Colors[point.GetColor12()];
            cell.name  = point.ToString();
            cell.SetAngle(-360f / FlatRhombPoint.SpliceCount * point.I);

            grid[point] = cell;
        }
    }
示例#3
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;
		}