C++博客-日出 http://www.598club.com/flipcode/??????????o???2????????????????????2 flipcode@qq.comzh-cnThu, 20 Feb 2020 17:09:24 GMTThu, 20 Feb 2020 17:09:24 GMT60C++博客-日出 http://www.598club.com/flipcode/archive/2020/01/09/max.htmlflipcodeflipcodeThu, 09 Jan 2020 02:35:00 GMThttp://www.598club.com/flipcode/archive/2020/01/09/max.htmlhttp://www.598club.com/flipcode/comments/217072.htmlhttp://www.598club.com/flipcode/archive/2020/01/09/max.html#Feedback0http://www.598club.com/flipcode/comments/commentRss/217072.htmlhttp://www.598club.com/flipcode/services/trackbacks/217072.html

flipcode 2020-01-09 10:35 ???????o
]]>
C++博客-日出 http://www.598club.com/flipcode/archive/2020/01/09/max_unity.htmlflipcodeflipcodeThu, 09 Jan 2020 01:59:00 GMThttp://www.598club.com/flipcode/archive/2020/01/09/max_unity.htmlhttp://www.598club.com/flipcode/comments/217071.htmlhttp://www.598club.com/flipcode/archive/2020/01/09/max_unity.html#Feedback0http://www.598club.com/flipcode/comments/commentRss/217071.htmlhttp://www.598club.com/flipcode/services/trackbacks/217071.html?a???max??o?????????????a????o????????????o????????o???????????

flipcode 2020-01-09 09:59 ???????o
]]>
C++博客-日出 http://www.598club.com/flipcode/archive/2020/01/03/unity_slg.htmlflipcodeflipcodeFri, 03 Jan 2020 10:09:00 GMThttp://www.598club.com/flipcode/archive/2020/01/03/unity_slg.htmlhttp://www.598club.com/flipcode/comments/217059.htmlhttp://www.598club.com/flipcode/archive/2020/01/03/unity_slg.html#Feedback0http://www.598club.com/flipcode/comments/commentRss/217059.htmlhttp://www.598club.com/flipcode/services/trackbacks/217059.htmlunity slg?????1????????-?1????????, ?????-???|??????????????????????????????a???3??o?????????????????????????????????????1?3???????????1?3??|????:
        // ???????: ?a???3??o????????????????????????3?:)(flipcode@qq.com)???
        public static Vector3 ToHexGrid(float xWorld, float yWorld)
        {
            int iGY = (int)(yWorld / (1.5 * edgeLength));
            bool odd = ((iGY & 1) != 0);
            // ??????
            if (odd)
            {
                xWorld -= halfGridWidth;
            }
            int iGX = (int)(xWorld / (2 * halfGridWidth));
            // ?????????-??|??????????:
            float OGX = iGX * (2 * halfGridWidth);
            float OGY = iGY * (1.5f * edgeLength);
            // ?????????????????-????(?????o????????????????????-??????1????|?????????3????):
            bool bOutProbably = (yWorld - OGY) < (edgeLength * 0.5f);
            if (bOutProbably)
            {
                // ?????Hex??-??????????????a???1???????????:
                float refX = OGX + halfGridWidth;
                float refY = OGY - edgeLength * 0.5f;
                float dx = Mathf.Abs(xWorld - refX);
                float dy = Mathf.Abs(yWorld - refY);
                float dt = dx + dy;
                // ???|????1:
                if (xWorld < refX)
                {
                    // ????????????-?,????????|????:
                    if (dt > edgeLength * 0.5f)
                    {
                        iGY--; // ?????????????????????|?y--
                               // ?|????????????????|????????|???x--
                        if (false == odd)
                        {
                            iGX--;
                        }
                    }
                }
                // ????3????1
                else
                {
                    // ????????????-?, ?????????3????:
                    if (dt > edgeLength * 0.5f)
                    {
                        iGY--; // ?????????????????????|?y--
                               // ?|?????????????????3????????|???x++
                        if (odd)
                        {
                            iGX++;
                        }
                    }
                }
            }
            Vector3 hexPos = new Vector3(iGX, 0, iGY);
            return hexPos;
        }
        public static Vector3 ToWorldPos(int iGX, int iGY)
        {
            bool odd = ((iGY & 1) != 0);
            // ?????????-??|??????????:
            float OGX = iGX * (2 * halfGridWidth);
            float OGY = iGY * (1.5f * edgeLength);
            // ???????|???3???????a????o|???
            if (odd)
            {
                OGX += halfGridWidth;
            }
            // ?????????????-???-?????????:
            Vector3 pos = new Vector3(OGX + halfGridWidth, 0, OGY + edgeLength);
            return pos;\
        }

????????????????????????????????????????


b?????????????????2??|ai??????????, ????????????????:


flipcode 2020-01-03 18:09 ???????o
]]>
C++博客-日出 http://www.598club.com/flipcode/archive/2020/01/03/unity_lwrp.htmlflipcodeflipcodeFri, 03 Jan 2020 10:01:00 GMThttp://www.598club.com/flipcode/archive/2020/01/03/unity_lwrp.htmlhttp://www.598club.com/flipcode/comments/217058.htmlhttp://www.598club.com/flipcode/archive/2020/01/03/unity_lwrp.html#Feedback0http://www.598club.com/flipcode/comments/commentRss/217058.htmlhttp://www.598club.com/flipcode/services/trackbacks/217058.html

flipcode 2020-01-03 18:01 ???????o
]]>
C++博客-日出 http://www.598club.com/flipcode/archive/2019/10/29/216959.htmlflipcodeflipcodeTue, 29 Oct 2019 08:20:00 GMThttp://www.598club.com/flipcode/archive/2019/10/29/216959.htmlhttp://www.598club.com/flipcode/comments/216959.htmlhttp://www.598club.com/flipcode/archive/2019/10/29/216959.html#Feedback0http://www.598club.com/flipcode/comments/commentRss/216959.htmlhttp://www.598club.com/flipcode/services/trackbacks/216959.html

flipcode 2019-10-29 16:20 ???????o
]]>
C++博客-日出 http://www.598club.com/flipcode/archive/2019/10/21/216948.htmlflipcodeflipcodeMon, 21 Oct 2019 10:29:00 GMThttp://www.598club.com/flipcode/archive/2019/10/21/216948.htmlhttp://www.598club.com/flipcode/comments/216948.htmlhttp://www.598club.com/flipcode/archive/2019/10/21/216948.html#Feedback0http://www.598club.com/flipcode/comments/commentRss/216948.htmlhttp://www.598club.com/flipcode/services/trackbacks/216948.html



flipcode 2019-10-21 18:29 ???????o
]]>
C++博客-日出 http://www.598club.com/flipcode/archive/2019/10/21/216947.htmlflipcode

flipcode 2019-10-21 18:12 ???????o
]]>
C++博客-日出 http://www.598club.com/flipcode/archive/2019/10/21/216946.htmlflipcode

flipcode 2019-10-21 18:08 ???????o
]]>
C++博客-日出 http://www.598club.com/flipcode/archive/2015/10/09/fow.htmlflipcodeflipcodeFri, 09 Oct 2015 03:33:00 GMThttp://www.598club.com/flipcode/archive/2015/10/09/fow.htmlhttp://www.598club.com/flipcode/comments/211976.htmlhttp://www.598club.com/flipcode/archive/2015/10/09/fow.html#Feedback1http://www.598club.com/flipcode/comments/commentRss/211976.htmlhttp://www.598club.com/flipcode/services/trackbacks/211976.html?a??????3?????????????????????????????-?????????????????????????????????????o????????????????????????:


??????????????:


flipcode 2015-10-09 11:33 ???????o
]]>
C++博客-日出 http://www.598club.com/flipcode/archive/2015/10/09/arpg.htmlflipcodeflipcodeFri, 09 Oct 2015 03:29:00 GMThttp://www.598club.com/flipcode/archive/2015/10/09/arpg.htmlhttp://www.598club.com/flipcode/comments/211975.htmlhttp://www.598club.com/flipcode/archive/2015/10/09/arpg.html#Feedback0http://www.598club.com/flipcode/comments/commentRss/211975.htmlhttp://www.598club.com/flipcode/services/trackbacks/211975.html


flipcode 2015-10-09 11:29 ???????o
]]>