public void ChangeCellState(List <NavCell> moveRange, HexCellState state) { for (int i = 0; i < moveRange.Count; i++) { moveRange[i].cell.State = state; } }
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(); }
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); }