Exemplo n.º 1
0
 public void ChangeCellState(List <NavCell> moveRange, HexCellState state)
 {
     for (int i = 0; i < moveRange.Count; i++)
     {
         moveRange[i].cell.State = state;
     }
 }
Exemplo n.º 2
0
        private void AddCellLabel(HexCellState cell)
        {
            var label = Instantiate(CellLabelPrefab);

            label.rectTransform.SetParent(GridSpaceCanvas.transform, false);
            label.rectTransform.anchoredPosition = new Vector2(cell.Position.x, cell.Position.z);
            label.text = cell.Coordinates.ToStringOnSeparateLines();
        }
Exemplo n.º 3
0
        private void CreateCell(int x, int z)
        {
            Vector3 position;

            // ReSharper disable once PossibleLossOfFraction
            position.x = (x + z * 0.5f - z / 2) * (HexMetrics.InnerRadius * 2f);
            position.y = 0f;
            position.z = z * (HexMetrics.OuterRadius * 1.5f);

            //TODO check position.
            var cell = new HexCellState
            {
                Coordinates = HexCoordinates.FromOffsetCoordinates(x, z),
                Color       = defaultColor,
                Position    = position
            };

            Cells.Add(cell);
        }