Ejemplo n.º 1
0
    private void BuildGrid()
    {
        root.transform.DestroyChildren();

        grid = FlatHexGrid <SpriteCell> .Hexagon(4);

        map = new FlatHexMap(HexDimensions)
              .AnchorCellMiddleCenter()
              .WithWindow(ExampleUtils.ScreenRect)
              .AlignMiddleCenter(grid)
              .To3DXY()
        ;

        foreach (FlatHexPoint 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.GetColor3_7()];
            cell.name  = point.ToString();

            grid[point] = cell;
        }
    }
Ejemplo n.º 2
0
    public void BuildGrid()
    {
        var spacing = battleCellPrefab.Dimensions;

        spacing.Scale(padding);

        Grid = FlatHexGrid <SectorCell> .Hexagon(size);

        Map = new FlatHexMap(spacing).AnchorCellMiddleCenter().To3DXZ();
//		Battle.Manager.state.allCells = new List<BattleCellState> ();
//		Battle.Manager.state.occupiedCells = new List<BattleCellState> ();
        foreach (var point in Grid)
        {
            var cell = Instantiate(battleCellPrefab);
//			cell.state.coordinates.x = point.X;
//			cell.state.coordinates.y = point.Y;
            Vector3 worldPoint = Map [point];
            cell.transform.parent        = this.transform;
            cell.transform.localScale    = Vector3.one;
            cell.transform.localPosition = worldPoint;

            cell.name    = point.ToString();
            Grid [point] = cell;
//			Battle.Manager.state.allCells.Add (cell.state);
        }
        positionCollider();
        createSpawnpoints();
    }
Ejemplo n.º 3
0
    public void BuilkdGrid()
    {
        var spacing = cellPrefab.Dimensions;

        spacing.Scale(padding);

        Grid = FlatHexGrid <Cell> .Hexagon(size);

        Map = new FlatHexMap(spacing).AnchorCellMiddleCenter().To3DXZ();

        foreach (var point in Grid)
        {
            var     cell       = Instantiate(cellPrefab);
            Vector3 worldPoint = Map [point];
            cell.transform.parent        = this.transform;
            cell.transform.localScale    = Vector3.one;
            cell.transform.localPosition = worldPoint;

            cell.name    = point.ToString();
            Grid [point] = cell;
        }
    }