Пример #1
0
    void Precalculation(HexCell cell)
    {
        cell.Center        = cell.WaterCenter = cell.transform.localPosition;
        cell.WaterCenter.y = HexMetrics.WaterSurfaceY;

        for (int i = 0; i <= 5; i++)
        {
            var direction = (HexDirection)i;

            cell.Edges[i] = new EdgeVertices(
                cell.Center + HexMetrics.GetLeftSolidCorner(direction),
                cell.Center + HexMetrics.GetRightSolidCorner(direction));

            if (cell.HasRiver && cell.HasRiverThroughEdge(direction))
            {
                cell.Edges[i].V3.y = cell.StreamBedY;
            }

            cell.WaterEdges[i] = new EdgeVertices(
                cell.WaterCenter + HexMetrics.GetLeftWaterCorner(direction),
                cell.WaterCenter + HexMetrics.GetRightWaterCorner(direction));
        }
    }