コード例 #1
0
        private Vector3 SpokePoint(HexMetrics metrics, HexCorner corner, float ringPercentage, float centerHeight, float[] cornerHeights)
        {
            // Base the height of the 'spokes' on the straight line from the center out to the corner of the whole tile
            Vector3 cornerVertex = HexUtils.CornerPosition((int)corner) * metrics.tileSize * ringPercentage;
            float   vertexHeight = centerHeight + (cornerHeights[corner.GetInt()] - centerHeight) * ringPercentage;

            return(cornerVertex + Vector3.up * (vertexHeight * metrics.mapHeight));
        }
コード例 #2
0
        public static Vector3 BridgePoint(HexMetrics metrics, HexCorner fromCorner, HexCorner towardCorner,
                                          float ringPercentage, float bridgePercentage, Vector3 centerVertex, float[] cornerHeights)
        {
            Vector3 cornerVertex = HexUtils.CornerPosition((int)fromCorner) * metrics.tileSize;

            cornerVertex = cornerVertex + Vector3.up * cornerHeights[fromCorner.GetInt()] * metrics.mapHeight;

            Vector3 nextCornerPoint = HexUtils.CornerPosition(towardCorner.GetInt()) * metrics.tileSize;

            nextCornerPoint = nextCornerPoint + Vector3.up * cornerHeights[towardCorner.GetInt()] * metrics.mapHeight;

            Vector3 vector      = nextCornerPoint - cornerVertex;
            float   bridgeMod   = 0.5f * (1f - bridgePercentage);
            Vector3 bridgePoint = cornerVertex + vector * bridgeMod;

            vector = centerVertex - bridgePoint;
            return(bridgePoint + vector * (1f - ringPercentage));
        }