예제 #1
0
	private void BuildGrid()
	{
		const int width = 5;
		const int height = 5;

		grid = PointyRhombGrid<SpriteCell>
			.BeginShape()
			.Rectangle(width, height)
			.EndShape();
		
		map = new PointyRhombMap(CellDimensions)
			.WithWindow(ExampleUtils.ScreenRect)
			.AlignMiddleCenter(grid)
			.To3DXY();


		foreach(PointyRhombPoint point in grid)
		{
			SpriteCell cell = Instantiate(cellPrefab);
			Vector3 worldPoint = map[point];
			cell.transform.parent = root.transform;
			cell.transform.localScale = Vector3.one;
			cell.transform.localPosition = worldPoint;
			cell.Color = ExampleUtils.Colors[point.GetColor12()];
			cell.name = point.ToString();
			cell.SetAngle(-360f / PointyRhombPoint.SpliceCount * point.I);

			grid[point] = cell;
		}
	}
예제 #2
0
        private void BuildGrid()
        {
            const int width  = 5;
            const int height = 5;

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

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


            foreach (PointyRhombPoint point in grid)
            {
                SpriteCell cell       = Instantiate(cellPrefab);
                Vector3    worldPoint = map[point];
                cell.transform.parent        = root.transform;
                cell.transform.localScale    = Vector3.one;
                cell.transform.localPosition = worldPoint;
                cell.Color = ExampleUtils.Colors[point.GetColor12()];
                cell.name  = point.ToString();
                cell.SetAngle(-360f / PointyRhombPoint.SpliceCount * point.I);

                grid[point] = cell;
            }
        }
예제 #3
0
		public static bool __CompilerHint__PointyRhomb__MeshTileCell()
		{
			var grid1 = new PointyHexGrid<MeshTileCell[]>(1, 1);

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

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

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

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

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