Ejemplo n.º 1
0
    public void Start()
    {
        map = new SimpleLayeredMap <PointyHexPoint>(new PointyHexMap(new Vector2(69, 80) * 5f), 200, 0);

        var shapes = new []
        {
            PointyHexGrid <Block> .BeginShape().Hexagon(6),
            PointyHexGrid <Block> .BeginShape().Hexagon(5),
            PointyHexGrid <Block> .BeginShape().Hexagon(4),
            PointyHexGrid <Block> .BeginShape().Hexagon(3),
            PointyHexGrid <Block> .BeginShape().Hexagon(2),
            PointyHexGrid <Block> .BeginShape().Hexagon(1)
        };

        grid = LayeredGrid <Block, PointyHexPoint> .Make <
            PointyHexShapeInfo <Block>,
            PointyHexGrid <Block>,
            PointyHexPoint, PointyHexPoint, PointyHexOp <Block> >(shapes);

        foreach (LayeredPoint <PointyHexPoint> point in grid)
        {
            var cell = Instantiate(cellPrefab);

            cell.transform.parent        = transform;
            cell.transform.localPosition = map[point];

            var color = ExampleUtils.Colors[(point.Point.GetColor1_3()) + 4];
            cell.GetComponent <Renderer>().material.color = color;

            cell.name = point.ToString();

            grid[point] = cell;
        }
    }
		public void Start()
		{
			map = new SimpleLayeredMap<PointyHexPoint>(new PointyHexMap(new Vector2(69, 80)*5f), 200, 0);

			var shapes = new[]
			{
				PointyHexGrid<Block>.BeginShape().Hexagon(6),
				PointyHexGrid<Block>.BeginShape().Hexagon(5),
				PointyHexGrid<Block>.BeginShape().Hexagon(4),
				PointyHexGrid<Block>.BeginShape().Hexagon(3),
				PointyHexGrid<Block>.BeginShape().Hexagon(2),
				PointyHexGrid<Block>.BeginShape().Hexagon(1)
			};

			grid = LayeredGrid<Block, PointyHexPoint>.Make<
				PointyHexShapeInfo<Block>,
				PointyHexGrid<Block>,
				PointyHexPoint, PointyHexPoint, PointyHexOp<Block>>(shapes);

			foreach (LayeredPoint<PointyHexPoint> point in grid)
			{
				var cell = Instantiate(cellPrefab);

				cell.transform.parent = transform;
				cell.transform.localPosition = map[point];

				var color = ExampleUtils.Colors[(point.Point.GetColor1_3()) + 4];
				cell.GetComponent<Renderer>().material.color = color;

				cell.name = point.ToString();

				grid[point] = cell;
			}
		}