GridGenerator.CalcWorldCoord C# (CSharp) Méthode

CalcWorldCoord() private méthode

private CalcWorldCoord ( int gridX, int gridY ) : Vector3
gridX int
gridY int
Résultat Vector3
    private Vector3 CalcWorldCoord(int gridX, int gridY)
    {
        //Every second row is offset by half of the tile width
        float offset = 0;
        if (gridY % 2 != 0)
            offset = m_hexWidth / 2;
        float worldX =  (float)m_initPos.x + offset + gridX * m_hexWidth;

        //Every new line is offset in z direction by 3/4 of the hexagon length
        float worldZ = (float)m_initPos.z - gridY * m_hexLength * 0.75f;
        return new Vector3(worldX, 0, worldZ);
    }