Ejemplo n.º 1
0
        private void BuildGrid()
        {
            const int side = 3;

            grid = PointyTriGrid <SpriteCell>
                   .Star(side);

            map = new PointyTriMap(TriDimensions)
                  .WithWindow(ExampleUtils.ScreenRect)
                  .AlignMiddleCenter(grid)
                  .AnchorCellMiddleCenter()
                  .To3DXY();

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

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

                cell.Color = ExampleUtils.Colors[point.GetColor(5, 1, 1)];
                cell.name  = point.ToString();
                cell.SetAngle(360f / PointyTriPoint.SpliceCount * point.I);

                grid[point] = cell;
            }
        }
		private void BuildGrid()
		{
			const int side = 3;

			grid = PointyTriGrid<SpriteCell>
				.Star(side);

			map = new PointyTriMap(TriDimensions)
				.WithWindow(ExampleUtils.ScreenRect)
				.AlignMiddleCenter(grid)
				.AnchorCellMiddleCenter()
				.To3DXY();

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

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

				cell.Color = ExampleUtils.Colors[point.GetColor(5, 1, 1)];
				cell.name = point.ToString();
				cell.SetAngle(360f/PointyTriPoint.SpliceCount*point.I);

				grid[point] = cell;
			}
		}
Ejemplo n.º 3
0
    public override IGrid <TCell, TPoint> MakeGrid <TCell, TPoint>()
    {
        if (typeof(TPoint) == typeof(PointyTriPoint))
        {
            var grid = PointyTriGrid <TCell>
                       .BeginShape()
                       //.ChainMail() //You can now chain the newly defined method to BeginShape
                       .ChainMail()
                       .EndShape();

            return((IGrid <TCell, TPoint>)grid);
        }

        Debug.LogError("<color=blue><b>" + GetType().ToString() + "</b></color> does not support grids for points of type " +
                       typeof(TPoint));


        return(null);
    }
Ejemplo n.º 4
0
		public static bool __CompilerHint__PointyTri__TileCell()
		{
			var grid1 = new FlatHexGrid<TileCell[]>(1, 1);

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

			var grid2 = new PointyTriGrid<TileCell>(1, 1);

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

			var shapeStorageInfo = new ShapeStorageInfo<PointyTriPoint>(new IntRect(), p => true);
			var shapeInfo = new PointyTriShapeInfo<TileCell>(shapeStorageInfo);

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