{"id":290082,"date":"2018-09-29T12:10:02","date_gmt":"2018-09-29T08:10:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=290082"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=290082","title":{"rendered":"\u041a\u0430\u0440\u0442\u044b \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0432 Unity: \u0447\u0430\u0441\u0442\u0438 1-3"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/305\/0b2\/d11\/3050b2d115d1ec49e2b6c945ab9ed4c1.jpg\" alt=\"image\"><\/div>\n<p>  <i>\u041e\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430: \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u0435\u0440\u0432\u0430\u044f \u0438\u0437 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 (27 \u0447\u0430\u0441\u0442\u0435\u0439) \u0441\u0435\u0440\u0438\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u0430\u0440\u0442 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0412\u043e\u0442, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432.<\/i><\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c1: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u043a\u0438 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432<\/h1>\n<p>  <\/p>\n<h2>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0432 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438.<\/li>\n<li>\u0422\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0442\u043a\u0443 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/li>\n<li>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043a\u0443\u0431\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.<\/li>\n<li>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u0441 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438 \u0441\u0435\u0442\u043a\u0438.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0432\u043d\u0443\u0442\u0440\u0438\u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440.<\/li>\n<\/ul>\n<p>  \u042d\u0442\u043e\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0441\u0435\u0440\u0438\u0438 \u043e \u043a\u0430\u0440\u0442\u0430\u0445 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0421\u0435\u0442\u043a\u0438 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0438\u0433\u0440\u0430\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f\u0445, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 Age of Wonders 3, Civilization 5 \u0438 Endless Legend. \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043e\u0441\u043d\u043e\u0432, \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0440\u0435\u043b\u044c\u0435\u0444 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u044b \u0443\u0436\u0435 \u0438\u0437\u0443\u0447\u0438\u043b\u0438 \u0441\u0435\u0440\u0438\u044e <i>Mesh Basics<\/i>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/procedural-grid\/\">Procedural Grid<\/a>. \u041e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043d\u0430 Unity 5.3.1. \u0412 \u0441\u0435\u0440\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0441\u0438\u0439 Unity. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u043d\u0430 Unity 2017.3.0p3.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/54e\/065\/633\/54e065633ba41c99214f720278b68336.png\"><\/div>\n<p>  <i>\u041f\u0440\u043e\u0441\u0442\u0430\u044f \u043a\u0430\u0440\u0442\u0430 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/i><\/p>\n<h2>\u041e \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u0445<\/h2>\n<p>  \u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438? \u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0435\u0442\u043a\u0430, \u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b. \u041a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0438 \u0432 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0441\u0435\u0442\u043a\u0438, \u0430 \u043f\u043e\u0442\u043e\u043c \u043d\u0430 \u0435\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0435\u0439.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/48f\/d4f\/9b8\/48fd4f9b87d5aa2381d9b03dbae704ae.png\"><\/div>\n<p>  <i>\u041a\u0432\u0430\u0434\u0440\u0430\u0442 \u0438 \u0435\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0438.<\/i><\/p>\n<p>  \u0412\u0441\u0435\u0433\u043e \u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u0435\u0441\u0442\u044c \u0432\u043e\u0441\u0435\u043c\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439. \u0427\u0435\u0442\u044b\u0440\u0451\u0445 \u0438\u0437 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c, \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0431\u0440\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430. \u042d\u0442\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0435\u0434\u0438. \u0414\u0440\u0443\u0433\u0438\u0445 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c, \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u0447\u0435\u0440\u0435\u0437 \u0443\u0433\u043e\u043b \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430. \u042d\u0442\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0435\u0434\u0438.<\/p>\n<p>  \u041a\u0430\u043a\u043e\u0432\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0446\u0435\u043d\u0442\u0440\u0430\u043c\u0438 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0445 \u044f\u0447\u0435\u0435\u043a \u0441\u0435\u0442\u043a\u0438? \u0415\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u0440\u0435\u0431\u0440\u0430 \u0440\u0430\u0432\u043d\u0430 1, \u0442\u043e \u0434\u043b\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u043e\u0442\u0432\u0435\u0442 \u0440\u0430\u0432\u0435\u043d 1. \u041d\u043e \u0434\u043b\u044f \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u043e\u0442\u0432\u0435\u0442 \u0440\u0430\u0432\u0435\u043d \u221a2.<\/p>\n<p>  \u0420\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0432\u0438\u0434\u0430\u043c\u0438 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c. \u0415\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u043a\u0430\u043a \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438? \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c \u043b\u0438 \u0435\u0433\u043e \u0432\u043e\u043e\u0431\u0449\u0435? \u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u0431\u043e\u043b\u0435\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0447\u043d\u044b\u043c? \u0412 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0433\u0440\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c\u0438. \u041e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u2014 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u0432\u043e\u043e\u0431\u0449\u0435, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0451 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/772\/47a\/9a1\/77247a9a1784bdbe1b736672460b95bf.png\"><\/div>\n<p>  <i>\u0428\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0438 \u0435\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0438.<\/i><\/p>\n<p>  \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430, \u0443 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043d\u0435 \u0432\u043e\u0441\u0435\u043c\u044c, \u0430 \u0448\u0435\u0441\u0442\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0441\u043e\u0441\u0435\u0434\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u043f\u043e \u0440\u0451\u0431\u0440\u0430\u043c, \u0443\u0433\u043b\u043e\u0432\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u043d\u0435\u0442. \u0422\u043e \u0435\u0441\u0442\u044c \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0442\u0438\u043f \u0441\u043e\u0441\u0435\u0434\u0435\u0439, \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e\u0435. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0441\u0435\u0442\u043a\u0443 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c, \u0447\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0443\u044e, \u043d\u043e \u043c\u044b \u0441 \u044d\u0442\u0438\u043c \u0441\u043f\u0440\u0430\u0432\u0438\u043c\u0441\u044f.<\/p>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0430\u0431\u043e\u0442\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u041f\u0443\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u0430 \u0440\u0435\u0431\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 10 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u043c. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043a\u0440\u0443\u0433\u0430 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438 \u0440\u0430\u0432\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0442\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0434\u043e \u043b\u044e\u0431\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u0442\u043e\u0436\u0435 \u0440\u0430\u0432\u043d\u043e 10. \u042d\u0442\u0430 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cdb\/a2f\/82f\/cdba2f82fb30358f0d2ca31c95f133d5.png\"><\/div>\n<p>  <i>\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/i><\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0440\u0430\u0434\u0438\u0443\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0434\u043e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0440\u0451\u0431\u0435\u0440. \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432\u0430\u0436\u0435\u043d, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0446\u0435\u043d\u0442\u0440\u0430\u043c\u0438 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0440\u0430\u0432\u043d\u043e \u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u043e\u043c\u0443 \u043d\u0430 \u0434\u0432\u0430. \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0440\u0430\u0432\u0435\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/562\/2c7\/d3a\/5622c7d3a9c7eb78171c48497bcf24bb.svg\" alt=\"$\\frac{\\sqrt{3}}{2}$\" data-tex=\"inline\"><\/math> \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0440\u0430\u0434\u0438\u0443\u0441\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/57b\/e8c\/b46\/57be8cb4685b47cd2153158d00d6329e.svg\" alt=\"$5 \\sqrt{3}$\" data-tex=\"inline\"><\/math>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u044d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public static class HexMetrics {  \tpublic const float outerRadius = 10f;  \tpublic const float innerRadius = outerRadius * 0.866025404f; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0440\u0430\u0434\u0438\u0443\u0441\u0430?<\/b><\/p>\n<div class=\"spoiler_text\">\u0412\u043e\u0437\u044c\u043c\u0451\u043c \u043e\u0434\u0438\u043d \u0438\u0437 \u0448\u0435\u0441\u0442\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0440\u0430\u0432\u0435\u043d \u0432\u044b\u0441\u043e\u0442\u0435 \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u042d\u0442\u0443 \u0432\u044b\u0441\u043e\u0442\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c, \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0432 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043d\u0430 \u0434\u0432\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u043e\u0439 \u041f\u0438\u0444\u0430\u0433\u043e\u0440\u0430.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0434\u043b\u0438\u043d\u044b \u0440\u0435\u0431\u0440\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5ca\/4b8\/ca1\/5ca4b8ca180f7495da819508f8afce6e.svg\" alt=\"$e$\" data-tex=\"inline\"><\/math> \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0440\u0430\u0432\u0435\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8fe\/4fc\/31d\/8fe4fc31df0189d844fc692a646e2b4e.svg\" alt=\"$\\sqrt{e^2 - (e\/2)^2} = \\sqrt{3e^2\/4} = e \\sqrt{3}\/2 \\approx 0.886e$\" data-tex=\"inline\"><\/math>.<\/div>\n<\/div>\n<p>  \u0415\u0441\u043b\u0438 \u0443\u0436 \u043c\u044b \u044d\u0442\u0438\u043c \u0437\u0430\u043d\u044f\u043b\u0438\u0441\u044c, \u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0448\u0435\u0441\u0442\u0438 \u0443\u0433\u043b\u043e\u0432 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0446\u0435\u043d\u0442\u0440\u0430 \u044f\u0447\u0435\u0439\u043a\u0438. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430: \u0432\u0432\u0435\u0440\u0445 \u043e\u0441\u0442\u0440\u043e\u0439 \u0438\u043b\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439. \u041c\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0432\u0432\u0435\u0440\u0445 \u0443\u0433\u043e\u043b. \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u044d\u0442\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u0438 \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435. \u041f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0438\u0445 \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c XZ, \u0447\u0442\u043e\u0431\u044b \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0431\u044b\u043b\u0438 \u043b\u0435\u0436\u0430\u043b\u0438 \u043d\u0430 \u0437\u0435\u043c\u043b\u0435.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5b2\/0eb\/95a\/5b20eb95ac844ed93a117b7d37f90e11.png\"><\/div>\n<p>  <i>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/i><\/p>\n<pre><code class=\"cs\">\tpublic static Vector3[] corners = { \t\tnew Vector3(0f, 0f, outerRadius), \t\tnew Vector3(innerRadius, 0f, 0.5f * outerRadius), \t\tnew Vector3(innerRadius, 0f, -0.5f * outerRadius), \t\tnew Vector3(0f, 0f, -outerRadius), \t\tnew Vector3(-innerRadius, 0f, -0.5f * outerRadius), \t\tnew Vector3(-innerRadius, 0f, 0.5f * outerRadius) \t};<\/code><\/pre>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-1\/about-hexagons\/about-hexagons.unitypackage\">unitypackage<\/a><\/p>\n<h2>\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u043a\u0438<\/h2>\n<p>  \u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u043a\u0438 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u044f\u0447\u0435\u0439\u043a\u0438 \u0441\u0435\u0442\u043a\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>HexCell<\/code>. \u041f\u043e\u043a\u0430 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u043f\u0443\u0441\u0442\u044b\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0435\u0449\u0451 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public class HexCell : MonoBehaviour { }<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442-\u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u043d\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u044f\u0447\u0435\u0439\u043a\u0438 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043c \u0432\u0441\u0451 \u044d\u0442\u043e \u0432 \u043f\u0440\u0435\u0444\u0430\u0431.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b61\/f1f\/3ab\/b61f1f3ab3210349434c2aff8c9ac374.png\"><\/div>\n<p>  <i>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0435\u0444\u0430\u0431\u0430 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f \u0441\u0435\u0442\u043a\u043e\u0439. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u043e\u0431\u0449\u0438\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0448\u0438\u0440\u0438\u043d\u044b, \u0432\u044b\u0441\u043e\u0442\u044b \u0438 \u043f\u0440\u0435\u0444\u0430\u0431\u0430 \u044f\u0447\u0435\u0439\u043a\u0438. \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0441\u0446\u0435\u043d\u0443 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public class HexGrid : MonoBehaviour {  \tpublic int width = 6; \tpublic int height = 6;  \tpublic HexCell cellPrefab;  }<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cad\/749\/12e\/cad74912e6a951918b4a3d0f4b9bb6bb.png\"><\/div>\n<p>  <i>\u041e\u0431\u044a\u0435\u043a\u0442 \u0441\u0435\u0442\u043a\u0438 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/i><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f. \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043a \u043d\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 10 \u043d\u0430 10 \u0435\u0434\u0438\u043d\u0438\u0446, \u0442\u043e \u0441\u043c\u0435\u0441\u0442\u0438\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u043d\u0430 \u044d\u0442\u0443 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443.<\/p>\n<pre><code class=\"cs\">\tHexCell[] cells;  \tvoid Awake () { \t\tcells = new HexCell[height * width];  \t\tfor (int z = 0, i = 0; z &lt; height; z++) { \t\t\tfor (int x = 0; x &lt; width; x++) { \t\t\t\tCreateCell(x, z, i++); \t\t\t} \t\t} \t} \t \tvoid CreateCell (int x, int z, int i) { \t\tVector3 position; \t\tposition.x = x * 10f; \t\tposition.y = 0f; \t\tposition.z = z * 10f;  \t\tHexCell cell = cells[i] = Instantiate&lt;HexCell&gt;(cellPrefab); \t\tcell.transform.SetParent(transform, false); \t\tcell.transform.localPosition = position; \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d11\/560\/321\/d11560321e63ac581846776aa5b658b6.png\"><\/div>\n<p>  <i>\u041a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0435\u0442\u043a\u0430 \u0438\u0437 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439.<\/i><\/p>\n<p>  \u0422\u0430\u043a \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u0441\u043f\u043b\u043e\u0448\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u0438\u0437 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0445 \u044f\u0447\u0435\u0435\u043a. \u041d\u043e \u043a\u0430\u043a\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f? \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u043e \u0441 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0411\u044b\u043b\u043e \u0431\u044b \u0443\u0434\u043e\u0431\u043d\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043c\u043e\u0433\u043b\u0438 \u0432\u0438\u0434\u0435\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u0441\u0435\u0445 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<h3>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442<\/h3>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0441\u0446\u0435\u043d\u0443 canvas, \u0432\u044b\u0431\u0440\u0430\u0432 <i>GameObject \/ UI \/ Canvas<\/i>, \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u0435\u0442\u043a\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e\u0442 canvas \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0443\u0434\u0430\u043b\u0438\u043c \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 raycaster. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 event system, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u0441\u0446\u0435\u043d\u0443, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u043a\u0430 \u043e\u043d \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u043b\u044f <i>Render Mode<\/i> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <i>World Space<\/i> \u0438 \u043f\u043e\u0432\u0435\u0440\u043d\u0438\u0442\u0435 \u043d\u0430 90 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u043f\u043e \u043e\u0441\u0438 X, \u0447\u0442\u043e\u0431\u044b canvas \u043d\u0430\u043b\u043e\u0436\u0438\u043b\u0441\u044f \u043d\u0430 \u0441\u0435\u0442\u043a\u0443. \u0417\u0430\u0434\u0430\u0439\u0442\u0435 \u0434\u043b\u044f pivot \u0438 \u0434\u043b\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 zero. \u041f\u0440\u0438\u0434\u0430\u0439\u0442\u0435 \u0435\u043c\u0443 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430\u0432\u0435\u0440\u0445\u0443. \u0428\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430 \u043d\u0430\u043c \u043d\u0435 \u0432\u0430\u0436\u043d\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0432 \u043e\u043a\u043d\u0435 \u0441\u0446\u0435\u043d\u044b.<\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0442\u0440\u0438\u0445\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043c <i>Dynamic Pixels Per Unit<\/i> \u0434\u043e 10. \u0422\u0430\u043a \u043c\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u043c, \u0447\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0443\u0440.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d37\/d5e\/34e\/d37d5e34e417e5d703d2915ef2e6ad19.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/374\/c37\/273\/374c37273c1e8e61befc30543efca5b2.png\"><\/div>\n<p>  <i>Canvas \u0434\u043b\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0441\u0435\u0442\u043a\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/i><\/p>\n<p>  \u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442 Text (<i>GameObject \/ UI \/ Text<\/i>) \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043c \u0435\u0433\u043e \u0432 \u043f\u0440\u0435\u0444\u0430\u0431. \u041e\u0442\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0433\u043e anchors \u0438 pivot, \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 5 \u043d\u0430 15. \u0422\u0435\u043a\u0441\u0442 \u0442\u043e\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0440\u043e\u0432\u043d\u0435\u043d \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443. \u0417\u0430\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430 4. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <i>Rich Text<\/i>. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 <i>Raycast Target<\/i>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e canvas \u043e\u043d \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f15\/c09\/d55\/f15c09d55444941d69d563940806340f.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d6d\/0df\/ab2\/d6d0dfab20e21276e48a2ca5bdc36503.png\"><\/div>\n<p>  <i>\u041f\u0440\u0435\u0444\u0430\u0431 \u043c\u0435\u0442\u043a\u0438 \u044f\u0447\u0435\u0439\u043a\u0438.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0441\u0435\u0442\u043a\u0435 \u043e canvas \u0438 \u043f\u0440\u0435\u0444\u0430\u0431\u0435. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0435\u0451 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 <code>using UnityEngine.UI;<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0438\u043f\u0443 <code>UnityEngine.UI.Text<\/code>. \u0414\u043b\u044f \u043f\u0440\u0435\u0444\u0430\u0431\u0430 \u043c\u0435\u0442\u043a\u0438 \u043d\u0443\u0436\u043d\u0430 \u043e\u0431\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0430 canvas \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u043c <code>GetComponentInChildren<\/code>.<\/p>\n<pre><code class=\"cs\">\tpublic Text cellLabelPrefab;  \tCanvas gridCanvas;  \tvoid Awake () { \t\tgridCanvas = GetComponentInChildren&lt;Canvas&gt;(); \t\t \t\t\u2026 \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/fae\/b30\/599\/faeb3059923e68e4b072a5b401086072.png\"><\/div>\n<p>  <i>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0444\u0430\u0431\u0430 \u043c\u0435\u0442\u043a\u0438.<\/i><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0444\u0430\u0431\u0430 \u043c\u0435\u0442\u043a\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0451 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u044f\u0447\u0435\u0439\u043a\u0438. \u041c\u0435\u0436\u0434\u0443 X \u0438 Z \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445.<\/p>\n<pre><code class=\"cs\">\tvoid CreateCell (int x, int z, int i) { \t\t\u2026  \t\tText label = Instantiate&lt;Text&gt;(cellLabelPrefab); \t\tlabel.rectTransform.SetParent(gridCanvas.transform, false); \t\tlabel.rectTransform.anchoredPosition = \t\t\tnew Vector2(position.x, position.z); \t\tlabel.text = x.ToString() + \"\\n\" + z.ToString(); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0e8\/1e2\/9b0\/0e81e29b0fd80afb2f7056a5b8ed829d.png\"><\/div>\n<p>  <i>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442.<\/i><\/p>\n<h3>\u041f\u043e\u0437\u0438\u0446\u0438\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044e. \u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438 \u0432 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 X \u0440\u0430\u0432\u043d\u043e \u0443\u0434\u0432\u043e\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u0440\u0430\u0434\u0438\u0443\u0441\u0443. \u041c\u044b \u044d\u0442\u0438\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u044f\u0447\u0435\u0435\u043a \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 1,5 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0440\u0430\u0434\u0438\u0443\u0441.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6e4\/269\/f40\/6e4269f40ead27d2ddb0dd75a1154d99.png\"><\/div>\n<p>  <i>\u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/i><\/p>\n<pre><code class=\"cs\">\t\tposition.x = x * (HexMetrics.innerRadius * 2f); \t\tposition.y = 0f; \t\tposition.z = z * (HexMetrics.outerRadius * 1.5f);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5ca\/d03\/034\/5cad03034d4aacacf5ccd49dccf0af3a.png\"><\/div>\n<p>  <i>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438 \u0431\u0435\u0437 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0439.<\/i><\/p>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u0430 \u043d\u0430\u0434 \u0434\u0440\u0443\u0433\u043e\u0439. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0430 \u043f\u043e \u043e\u0441\u0438 X \u043d\u0430 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0440\u0430\u0434\u0438\u0443\u0441\u0430. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c, \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0432 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 Z \u043a X, \u0430 \u0437\u0430\u0442\u0435\u043c \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0443\u0434\u0432\u043e\u0435\u043d\u043d\u044b\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0440\u0430\u0434\u0438\u0443\u0441.<\/p>\n<pre><code class=\"cs\">\t\tposition.x = (x + z * 0.5f) * (HexMetrics.innerRadius * 2f);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/75c\/e06\/f65\/75ce06f65db02737bddf223d45f6b8f3.png\"><\/div>\n<p>  <i>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0441\u0435\u0442\u043a\u0443 \u0432 \u0432\u0438\u0434\u0435 \u0440\u043e\u043c\u0431\u0430.<\/i><\/p>\n<p>  \u0425\u043e\u0442\u044f \u0442\u0430\u043a \u043c\u044b \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b\u0438 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u043d\u0430\u0448\u0430 \u0441\u0435\u0442\u043a\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0440\u043e\u043c\u0431, \u0430 \u043d\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u041d\u0430\u043c \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0435\u0442\u043a\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u044f\u0447\u0435\u0439\u043a\u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0441\u0442\u0440\u043e\u0439. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0432\u0435\u0440\u043d\u0443\u0432 \u043d\u0430\u0437\u0430\u0434 \u0447\u0430\u0441\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f. \u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u0441\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 \u043e\u0434\u0438\u043d \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0433. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f Z \u043d\u0430 2.<\/p>\n<pre><code class=\"cs\">\t\tposition.x = (x + z * 0.5f - z \/ 2) * (HexMetrics.innerRadius * 2f);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/519\/429\/30a\/51942930aa48daab518847429e4c8b74.png\"><\/div>\n<p>  <i>\u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0432 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438.<\/i><\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-1\/grid-construction\/grid-construction.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432<\/h2>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0432 \u044f\u0447\u0435\u0439\u043a\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0434\u0430\u043b\u0438\u043c \u0438\u0437 \u043f\u0440\u0435\u0444\u0430\u0431\u0430 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u043a\u0440\u043e\u043c\u0435 <code>HexCell<\/code>.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/48f\/32a\/214\/48f32a214e6ef61f580a0147a5f310da.png\"><\/div>\n<p>  <i>\u041f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442.<\/i><\/p>\n<p>  \u041a\u0430\u043a \u0438 \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/procedural-grid\">Mesh Basics<\/a>, \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0432\u0441\u0435\u0439 \u0441\u0435\u0442\u043a\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0434\u0438\u043d \u043c\u0435\u0448. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u0436\u043d\u044b\u0445 \u0432\u0435\u0440\u0448\u0438\u043d \u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>HexMesh<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0439\u043c\u0451\u0442\u0441\u044f \u043d\u0430\u0448\u0438\u043c \u043c\u0435\u0448\u0435\u043c. \u0414\u043b\u044f \u043d\u0435\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f mesh filter \u0438 renderer, \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043c\u0435\u0448 \u0438 \u0441\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f \u0432\u0435\u0440\u0448\u0438\u043d \u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/p>\n<pre><code class=\"cs\">using UnityEngine; using System.Collections.Generic;  [RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))] public class HexMesh : MonoBehaviour {  \tMesh hexMesh; \tList&lt;Vector3&gt; vertices; \tList&lt;int&gt; triangles;  \tvoid Awake () { \t\tGetComponent&lt;MeshFilter&gt;().mesh = hexMesh = new Mesh(); \t\thexMesh.name = \"Hex Mesh\"; \t\tvertices = new List&lt;Vector3&gt;(); \t\ttriangles = new List&lt;int&gt;(); \t} }<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u043a\u0438 \u043d\u043e\u0432\u044b\u0439 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c. \u041e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 mesh renderer, \u043d\u043e \u0435\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u043d\u0435\u043c\u0443 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f2a\/831\/2ab\/f2a8312ab61274a7563aeeb7860c3609.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8ab\/bf1\/710\/8abbf17103e93485e696daf3a94bb277.png\"><\/div>\n<p>  <i>\u041e\u0431\u044a\u0435\u043a\u0442 Hex mesh.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c <code>HexGrid<\/code> \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u0435\u0448 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u0430\u043a \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u043b canvas.<\/p>\n<pre><code class=\"cs\">\tHexMesh hexMesh;  \tvoid Awake () { \t\tgridCanvas = GetComponentInChildren&lt;Canvas&gt;(); \t\thexMesh = GetComponentInChildren&lt;HexMesh&gt;(); \t\t \t\t\u2026 \t}<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 Awake \u0441\u0435\u0442\u043a\u0438 \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u0438\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u0435\u0448\u0443 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u044f\u0447\u0435\u0439\u043a\u0438. \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043f\u043e\u0441\u043b\u0435 Awake \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 hex mesh. \u0422\u0430\u043a \u043a\u0430\u043a <code>Start<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0437\u0436\u0435, \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0442\u0443\u0434\u0430.<\/p>\n<pre><code class=\"cs\">\tvoid Start () { \t\thexMesh.Triangulate(cells); \t}<\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 <code>HexMesh.Triangulate<\/code> \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044f\u0447\u0435\u0439\u043a\u0438 \u0443\u0436\u0435 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0440\u0430\u043d\u0435\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0441\u0442\u0430\u0440\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u043e\u0431\u0445\u043e\u0434\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 \u043f\u043e \u0432\u0441\u0435\u043c \u044f\u0447\u0435\u0439\u043a\u0430\u043c \u043c\u044b \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0432 \u044d\u0442\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043c\u0435\u0448\u0443, \u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043c \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442\u043e\u043c \u043d\u043e\u0440\u043c\u0430\u043b\u0435\u0439 \u043c\u0435\u0448\u0430.<\/p>\n<pre><code class=\"cs\">\tpublic void Triangulate (HexCell[] cells) { \t\thexMesh.Clear(); \t\tvertices.Clear(); \t\ttriangles.Clear(); \t\tfor (int i = 0; i &lt; cells.Length; i++) { \t\t\tTriangulate(cells[i]); \t\t} \t\thexMesh.vertices = vertices.ToArray(); \t\thexMesh.triangles = triangles.ToArray(); \t\thexMesh.RecalculateNormals(); \t} \t \tvoid Triangulate (HexCell cell) { \t}<\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0438\u0437 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0442\u0440\u0451\u0445 \u0432\u0435\u0440\u0448\u0438\u043d. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443. \u0422\u0430\u043a\u0436\u0435 \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u044d\u0442\u0438\u0445 \u0432\u0435\u0440\u0448\u0438\u043d, \u0447\u0442\u043e\u0431\u044b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u0418\u043d\u0434\u0435\u043a\u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0440\u0430\u0432\u0435\u043d \u0434\u043b\u0438\u043d\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0435\u0440\u0448\u0438\u043d \u0434\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u043d\u0435\u0433\u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0448\u0438\u043d. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0432\u0435\u0440\u0448\u0438\u043d.<\/p>\n<pre><code class=\"cs\">\tvoid AddTriangle (Vector3 v1, Vector3 v2, Vector3 v3) { \t\tint vertexIndex = vertices.Count; \t\tvertices.Add(v1); \t\tvertices.Add(v2); \t\tvertices.Add(v3); \t\ttriangles.Add(vertexIndex); \t\ttriangles.Add(vertexIndex + 1); \t\ttriangles.Add(vertexIndex + 2); \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u044f\u0447\u0435\u0439\u043a\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u0415\u0433\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0446\u0435\u043d\u0442\u0440\u0435 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u0414\u0432\u0443\u043c\u044f \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0443\u0433\u043b\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0446\u0435\u043d\u0442\u0440\u0430.<\/p>\n<pre><code class=\"cs\">\tvoid Triangulate (HexCell cell) { \t\tVector3 center = cell.transform.localPosition; \t\tAddTriangle( \t\t\tcenter, \t\t\tcenter + HexMetrics.corners[0], \t\t\tcenter + HexMetrics.corners[1] \t\t); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/860\/d2b\/ca3\/860d2bca3ec0d1c95bd66082735021f7.png\"><\/div>\n<p>  <i>\u041f\u0435\u0440\u0432\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438.<\/i><\/p>\n<p>  \u042d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043e\u0439\u0434\u0451\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 \u0432\u0441\u0435 \u0448\u0435\u0441\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/p>\n<pre><code class=\"cs\">\t\tVector3 center = cell.transform.localPosition; \t\tfor (int i = 0; i &lt; 6; i++) { \t\t\tAddTriangle( \t\t\t\tcenter, \t\t\t\tcenter + HexMetrics.corners[i], \t\t\t\tcenter + HexMetrics.corners[i + 1] \t\t\t); \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043e\u0431\u0449\u0438\u043c\u0438?<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430, \u043c\u043e\u0436\u043d\u043e. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0451 \u043b\u0443\u0447\u0448\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u0448\u0435\u0441\u0442\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0432\u0441\u0435\u0433\u043e \u0447\u0435\u0442\u044b\u0440\u0435. \u041d\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u0432\u0448\u0438\u0441\u044c \u043e\u0442 \u044d\u0442\u043e\u0433\u043e, \u043c\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043c \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0438 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 \u0432\u0441\u0451 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0435\u0440\u0448\u0438\u043d \u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442 \u043d\u0430\u043c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/div>\n<\/div>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a <code>IndexOutOfRangeException<\/code>. \u0422\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0435\u0434\u044c\u043c\u043e\u0439 \u0443\u0433\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430\u0437\u0430\u0434 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430. \u0418\u043b\u0438 \u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0443\u0433\u043e\u043b \u0432 <code>HexMetrics.corners<\/code>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442\u044c \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<pre><code class=\"cs\">\tpublic static Vector3[] corners = { \t\tnew Vector3(0f, 0f, outerRadius), \t\tnew Vector3(innerRadius, 0f, 0.5f * outerRadius), \t\tnew Vector3(innerRadius, 0f, -0.5f * outerRadius), \t\tnew Vector3(0f, 0f, -outerRadius), \t\tnew Vector3(-innerRadius, 0f, -0.5f * outerRadius), \t\tnew Vector3(-innerRadius, 0f, 0.5f * outerRadius), \t\tnew Vector3(0f, 0f, outerRadius) \t};<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c8d\/277\/e13\/c8d277e139df24953e9b381fabca2a42.png\"><\/div>\n<p>  <i>\u0428\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.<\/i><\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-1\/rendering-hexagons\/rendering-hexagons.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u0428\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b<\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043d\u043e\u0432\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u044f\u0447\u0435\u0435\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u0435\u0442\u043a\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 Z \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 X \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0437\u0438\u0433\u0437\u0430\u0433\u0430\u043c\u0438. \u042d\u0442\u043e \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0434\u043b\u044f \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/73f\/745\/502\/73f745502f1d8d20245bd22edc99a3ce.png\"><\/div>\n<p>  <i>\u0421\u043c\u0435\u0449\u0451\u043d\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/i><\/p>\n<p>  \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438 \u0442\u0430\u043a\u0438\u0435 \u0441\u043c\u0435\u0449\u0451\u043d\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c struct <code>HexCoordinates<\/code>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0451 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u043e\u0439, \u0447\u0442\u043e\u0431\u044b Unity \u043c\u043e\u0433 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0451 \u0438 \u043e\u043d\u0430 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u043b\u0430 \u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 Play. \u0422\u0430\u043a\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b immutable, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 public readonly.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  [System.Serializable] public struct HexCoordinates {  \tpublic int X { get; private set; }  \tpublic int Z { get; private set; }  \tpublic HexCoordinates (int x, int z) { \t\tX = x; \t\tZ = z; \t} }<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0438\u0437 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0441\u043c\u0435\u0449\u0451\u043d\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442. \u041f\u043e\u043a\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b.<\/p>\n<pre><code class=\"cs\">\tpublic static HexCoordinates FromOffsetCoordinates (int x, int z) { \t\treturn new HexCoordinates(x, z); \t} }<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0436\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a. \u041c\u0435\u0442\u043e\u0434 <code>ToString<\/code> \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 struct, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u043c \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e. \u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0435\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435. \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u0441\u0445\u0435\u043c\u0443.<\/p>\n<pre><code class=\"cs\">\tpublic override string ToString () { \t\treturn \"(\" + X.ToString() + \", \" + Z.ToString() + \")\"; \t}  \tpublic string ToStringOnSeparateLines () { \t\treturn X.ToString() + \"\\n\" + Z.ToString(); \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 <code>HexCell<\/code>.<\/p>\n<pre><code class=\"cs\">public class HexCell : MonoBehaviour {  \tpublic HexCoordinates coordinates; }<\/code><\/pre>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0438\u043c <code>HexGrid.CreateCell<\/code> \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cs\">\t\tHexCell cell = cells[i] = Instantiate&lt;HexCell&gt;(cellPrefab); \t\tcell.transform.SetParent(transform, false); \t\tcell.transform.localPosition = position; \t\tcell.coordinates = HexCoordinates.FromOffsetCoordinates(x, z); \t\t \t\tText label = Instantiate&lt;Text&gt;(cellLabelPrefab); \t\tlabel.rectTransform.SetParent(gridCanvas.transform, false); \t\tlabel.rectTransform.anchoredPosition = \t\t\tnew Vector2(position.x, position.z); \t\tlabel.text = cell.coordinates.ToStringOnSeparateLines();<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b X, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0432\u044b\u0440\u043e\u0432\u043d\u0435\u043d\u044b \u0432\u0434\u043e\u043b\u044c \u043f\u0440\u044f\u043c\u043e\u0439 \u043e\u0441\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043e\u0442\u043c\u0435\u043d\u0438\u0432 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0434\u0432\u0438\u0433. \u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043e\u0441\u0435\u0432\u044b\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cs\">\tpublic static HexCoordinates FromOffsetCoordinates (int x, int z) { \t\treturn new HexCoordinates(x - z \/ 2, z); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/433\/1bf\/29d\/4331bf29dbf016e466a3636b5cd90311.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4ab\/03d\/7af\/4ab03d7afdef480fe4657ae86901fd1a.png\"><\/div>\n<p>  <i>\u041e\u0441\u0435\u0432\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b.<\/i><\/p>\n<p>  \u042d\u0442\u0430 \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0434\u0432\u0430 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0435\u0442\u044c\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435. \u0418 \u0432 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0435\u0441\u043b\u044b \u0431\u044b \u043c\u044b \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 X, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0431\u044b \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0435\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 Y.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/32c\/39b\/9b7\/32c39b9b7705099d7bcb8e525aa6fe48.png\"><\/div>\n<p>  <i>\u041f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 Y.<\/i><\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f X \u0438 Y \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u043e\u043f\u0438\u044f\u043c\u0438 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430, \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u0430\u0451\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0435\u0441\u043b\u0438 Z \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u043c. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0435\u0441\u043b\u0438 \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0441\u0435 \u0442\u0440\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0442\u043e \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u043e\u043b\u044c. \u0415\u0441\u043b\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443, \u0442\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e. \u0418 \u0432 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u0442\u043e \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u0448\u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f. \u0422\u0430\u043a\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u0443\u0431\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u044b, \u0430 \u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u044f \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043a\u0443\u0431.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e, \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0438\u0437 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0434\u0440\u0443\u0433\u0438\u0445. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b X \u0438 Z, \u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443 Y. <br \/>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0449\u0435\u0435 \u0435\u0451 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445.<\/p>\n<pre><code class=\"cs\">\tpublic int Y { \t\tget { \t\t\treturn -X - Z; \t\t} \t}  \tpublic override string ToString () { \t\treturn \"(\" + \t\t\tX.ToString() + \", \" + Y.ToString() + \", \" + Z.ToString() + \")\"; \t}  \tpublic string ToStringOnSeparateLines () { \t\treturn X.ToString() + \"\\n\" + Y.ToString() + \"\\n\" + Z.ToString(); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c36\/ad9\/d32\/c36ad9d322193e811fd6c59b5d76249a.png\"><\/div>\n<p>  <i>\u041a\u0443\u0431\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b.<\/i><\/p>\n<h3>\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0435<\/h3>\n<p>  \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 Play \u043e\u0434\u043d\u0443 \u0438\u0437 \u044f\u0447\u0435\u0435\u043a \u0441\u0435\u0442\u043a\u0438. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440 \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0435\u0451 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043a\u0430 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 <code>HexCell.coordinates<\/code>.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d02\/a1d\/a0e\/d02a1da0e906223abcb9aeeb46ce7477.png\"><\/div>\n<p>  <i>\u0418\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440 \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b.<\/i><\/p>\n<p>  \u0425\u043e\u0442\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442, \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. Unity \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u043a\u0430\u043a \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u0435 \u043f\u043e\u043b\u044f. \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0445, \u043d\u0443\u0436\u043d\u043e \u044f\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u043e\u043b\u044f \u0434\u043b\u044f X \u0438 Z.<\/p>\n<pre><code class=\"cs\">\t[SerializeField] \tprivate int x, z;  \tpublic int X { \t\tget { \t\t\treturn x; \t\t} \t}  \tpublic int Z { \t\tget { \t\t\treturn z; \t\t} \t}  \tpublic HexCoordinates (int x, int z) { \t\tthis.x = x; \t\tthis.z = z; \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5ea\/264\/fff\/5ea264fffa724e10205c41c8191ad78b.png\"><\/div>\n<p>  \u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b X \u0438 Z \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f, \u043d\u043e \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c. \u041d\u0430\u043c \u044d\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438. \u0422\u0430\u043a\u0436\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u043f\u043e\u0434 \u0434\u0440\u0443\u0433\u043e\u043c.<\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 property drawer \u0434\u043b\u044f \u0442\u0438\u043f\u0430 <code>HexCoordinates<\/code>. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 <code>HexCoordinatesDrawer<\/code> \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 <i>Editor<\/i>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430.<\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c <code>UnityEditor.PropertyDrawer<\/code> \u0438 \u0435\u043c\u0443 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>UnityEditor.CustomPropertyDrawer<\/code>, \u0447\u0442\u043e\u0431\u044b \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0442\u0438\u043f\u043e\u043c.<\/p>\n<pre><code class=\"cs\">using UnityEngine; using UnityEditor;  [CustomPropertyDrawer(typeof(HexCoordinates))] public class HexCoordinatesDrawer : PropertyDrawer { }<\/code><\/pre>\n<p>  Property drawers \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u0441\u0432\u043e\u0451 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>OnGUI<\/code>. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u044d\u043a\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043a\u0443 \u043f\u043e\u043b\u044f, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d\u0438 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442.<\/p>\n<pre><code class=\"cs\">\tpublic override void OnGUI ( \t\tRect position, SerializedProperty property, GUIContent label \t) { \t}<\/code><\/pre>\n<p>  \u0418\u0437\u0432\u043b\u0435\u0447\u0451\u043c \u0438\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f x \u0438 z, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0445 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442. \u0417\u0430\u0442\u0435\u043c \u043e\u0442\u0440\u0438\u0441\u0443\u0435\u043c \u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043c\u0435\u0442\u043a\u0443 GUI \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>HexCoordinates.ToString<\/code>.<\/p>\n<pre><code class=\"cs\">\tpublic override void OnGUI ( \t\tRect position, SerializedProperty property, GUIContent label \t) { \t\tHexCoordinates coordinates = new HexCoordinates( \t\t\tproperty.FindPropertyRelative(\"x\").intValue, \t\t\tproperty.FindPropertyRelative(\"z\").intValue \t\t); \t\t \t\tGUI.Label(position, coordinates.ToString()); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1d6\/d0f\/852\/1d6d0f852f744b6b5080a54478a3f4bf.png\"><\/div>\n<p>  <i>\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0431\u0435\u0437 \u043c\u0435\u0442\u043a\u0438 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430.<\/i><\/p>\n<p>  \u0422\u0430\u043a \u043c\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044f. \u042d\u0442\u0438 \u0438\u043c\u0435\u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>EditorGUI.PrefixLabel<\/code>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u043e\u043d\u0443\u0441\u0430 \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u044b\u0440\u043e\u0432\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0443 \u0441\u043f\u0440\u0430\u0432\u0430 \u043e\u0442 \u044d\u0442\u043e\u0439 \u043c\u0435\u0442\u043a\u0438.<\/p>\n<pre><code class=\"cs\">\t\tposition = EditorGUI.PrefixLabel(position, label); \t\tGUI.Label(position, coordinates.ToString());<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a6c\/d34\/856\/a6cd348569c891e063c6fc515d075d04.png\"><\/div>\n<p>  <i>\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441 \u043c\u0435\u0442\u043a\u043e\u0439.<\/i><\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-1\/hexagonal-coordinates\/hexagonal-coordinates.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u041a\u0430\u0441\u0430\u0435\u043c\u0441\u044f \u044f\u0447\u0435\u0435\u043a<\/h2>\n<p>  \u0421\u0435\u0442\u043a\u0430 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430, \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0441 \u043d\u0435\u0439 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u0441\u0430\u043d\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443. \u041f\u043e\u043a\u0430 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 <code>HexGrid<\/code>. \u041a\u043e\u0433\u0434\u0430 \u043e\u043d \u043d\u0430\u0447\u043d\u0451\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043c\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u0435 \u043c\u0435\u0441\u0442\u043e.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043a\u043e\u0441\u043d\u0443\u0442\u044c\u0441\u044f \u044f\u0447\u0435\u0439\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432 \u0441\u0446\u0435\u043d\u0443 \u043b\u0443\u0447\u0438 \u0438\u0437 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043c\u044b\u0448\u0438. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434, \u0447\u0442\u043e \u0438 \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/mesh-deformation\">Mesh Deformation<\/a>.<\/p>\n<pre><code class=\"cs\">\tvoid Update () { \t\tif (Input.GetMouseButton(0)) { \t\t\tHandleInput(); \t\t} \t}  \tvoid HandleInput () { \t\tRay inputRay = Camera.main.ScreenPointToRay(Input.mousePosition); \t\tRaycastHit hit; \t\tif (Physics.Raycast(inputRay, out hit)) { \t\t\tTouchCell(hit.point); \t\t} \t} \t \tvoid TouchCell (Vector3 position) { \t\tposition = transform.InverseTransformPoint(position); \t\tDebug.Log(\"touched at \" + position); \t}<\/code><\/pre>\n<p>  \u041f\u043e\u043a\u0430 \u043a\u043e\u0434 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u0441\u0435\u0442\u043a\u0435 \u043a\u043e\u043b\u043b\u0430\u0439\u0434\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043b\u0443\u0447 \u043c\u043e\u0433 \u0441 \u0447\u0435\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0434\u0438\u043c <code>HexMesh<\/code> \u043c\u0435\u0448 \u043a\u043e\u043b\u043b\u0430\u0439\u0434\u0435\u0440\u0430.<\/p>\n<pre><code class=\"cs\">\tMeshCollider meshCollider;  \tvoid Awake () { \t\tGetComponent&lt;MeshFilter&gt;().mesh = hexMesh = new Mesh(); \t\tmeshCollider = gameObject.AddComponent&lt;MeshCollider&gt;(); \t\t\u2026 \t}<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043c \u043c\u0435\u0448 \u043a\u043e\u043b\u043b\u0430\u0439\u0434\u0435\u0440\u0443.<\/p>\n<pre><code class=\"cs\">\tpublic void Triangulate (HexCell[] cells) { \t\t\u2026 \t\tmeshCollider.sharedMesh = hexMesh; \t}<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0430\u0437\u0432\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c box collider?<\/b><\/p>\n<div class=\"spoiler_text\">\u041c\u043e\u0436\u0435\u043c, \u043d\u043e \u043e\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u0447\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0443\u0440\u0443 \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u043a\u0438. \u0414\u0430 \u0438 \u043d\u0430\u0448\u0430 \u0441\u0435\u0442\u043a\u0430 \u043d\u0435\u0434\u043e\u043b\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0439, \u043d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0442\u0435\u043c\u0430 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432.<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u0430\u0441\u0430\u0442\u044c\u0441\u044f \u0441\u0435\u0442\u043a\u0438! \u041d\u043e \u043a\u0430\u043a\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u043c\u044b \u043a\u0430\u0441\u0430\u0435\u043c\u0441\u044f? \u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u044d\u0442\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0434\u043b\u044f <code>HexCoordinates<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u044a\u044f\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 <code>FromPosition<\/code>.<\/p>\n<pre><code class=\"cs\">\tpublic void TouchCell (Vector3 position) { \t\tposition = transform.InverseTransformPoint(position); \t\tHexCoordinates coordinates = HexCoordinates.FromPosition(position); \t\tDebug.Log(\"touched at \" + coordinates.ToString()); \t}<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u0438? \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c x \u043d\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0448\u0438\u0440\u0438\u043d\u0443 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u0410 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 Y \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b X, \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 x \u0434\u0430\u0451\u0442 \u043d\u0430\u043c y.<\/p>\n<pre><code class=\"cs\">\tpublic static HexCoordinates FromPosition (Vector3 position) { \t\tfloat x = position.x \/ (HexMetrics.innerRadius * 2f); \t\tfloat y = -x; \t}<\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u0434\u0430\u0432\u0430\u043b\u043e \u0431\u044b \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0435\u0441\u043b\u0438 \u0431\u044b Z \u0431\u044b\u043b\u0430 \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e. \u041c\u044b \u0441\u043d\u043e\u0432\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0434\u0432\u0438\u0433 \u043f\u0440\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u0432\u0434\u043e\u043b\u044c Z. \u0427\u0435\u0440\u0435\u0437 \u043a\u0430\u0436\u0434\u044b\u0435 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0432\u043b\u0435\u0432\u043e \u043d\u0430 \u0432\u0441\u044e \u0435\u0434\u0438\u043d\u0438\u0446\u0443.<\/p>\n<pre><code class=\"cs\">\t\tfloat offset = position.z \/ (HexMetrics.outerRadius * 3f); \t\tx -= offset; \t\ty -= offset;<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u0448\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f x \u0438 y \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0432 \u0446\u0435\u043d\u0442\u0440\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u044f \u0438\u0445 \u0434\u043e \u0446\u0435\u043b\u044b\u0445, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c Z \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b.<\/p>\n<pre><code class=\"cs\">\t\tint iX = Mathf.RoundToInt(x); \t\tint iY = Mathf.RoundToInt(y); \t\tint iZ = Mathf.RoundToInt(-x -y);  \t\treturn new HexCoordinates(iX, iZ);<\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0435, \u043d\u043e \u0432\u0435\u0440\u043d\u044b \u043b\u0438 \u044d\u0442\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b? \u041f\u0440\u0438 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0441\u0443\u043c\u043c\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<pre><code class=\"cs\">\t\tif (iX + iY + iZ != 0) { \t\t\tDebug.LogWarning(\"rounding error!\"); \t\t} \t\t \t\treturn new HexCoordinates(iX, iZ);<\/code><\/pre>\n<p>  \u041c\u044b \u0438 \u0432 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f. \u041a\u0430\u043a \u043d\u0430\u043c \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0443 \u043e\u0448\u0438\u0431\u043a\u0443? \u041e\u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u044f\u0434\u043e\u043c \u0441 \u0440\u0451\u0431\u0440\u0430\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442. \u041a\u0430\u043a\u0430\u044f \u0438\u0437 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u0432\u0435\u0440\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443? \u0427\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u043e\u0442\u0445\u043e\u0434\u0438\u043c \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u044f\u0447\u0435\u0439\u043a\u0438, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430, \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u0435\u043c\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0445.<\/p>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443 \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0434\u0435\u043b\u044c\u0442\u043e\u0439 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u044f \u0438 \u0432\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0451 \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u0432\u0443\u0445 \u0434\u0440\u0443\u0433\u0438\u0445. \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e X \u0438 Z, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0435 \u0443\u0442\u0440\u0443\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0432\u043e\u0441\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c Y.<\/p>\n<pre><code class=\"cs\">\t\tif (iX + iY + iZ != 0) { \t\t\tfloat dX = Mathf.Abs(x - iX); \t\t\tfloat dY = Mathf.Abs(y - iY); \t\t\tfloat dZ = Mathf.Abs(-x -y - iZ);  \t\t\tif (dX &gt; dY &amp;&amp; dX &gt; dZ) { \t\t\t\tiX = -iY - iZ; \t\t\t} \t\t\telse if (dZ &gt; dY) { \t\t\t\tiZ = -iX - iY; \t\t\t} \t\t}<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0420\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0430 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u0430\u0441\u0430\u0442\u044c\u0441\u044f \u0432\u0435\u0440\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438, \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0431\u0443\u0434\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u043e\u043f\u0430\u0434\u0451\u043c. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u043b\u044f <code>HexGrid<\/code> \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438.<\/p>\n<pre><code class=\"cs\">\tpublic Color defaultColor = Color.white; \tpublic Color touchedColor = Color.magenta;<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/33d\/89a\/d05\/33d89ad0522ace10075800607aac71b2.png\"><\/div>\n<p>  <i>\u0412\u044b\u0431\u043e\u0440 \u0446\u0432\u0435\u0442\u0430 \u044f\u0447\u0435\u0435\u043a.<\/i><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a <code>HexCell<\/code> \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0446\u0432\u0435\u0442\u0430.<\/p>\n<pre><code class=\"cs\">public class HexCell : MonoBehaviour {  \tpublic HexCoordinates coordinates;  \tpublic Color color; }<\/code><\/pre>\n<p>  \u041d\u0430\u0437\u043d\u0430\u0447\u0438\u043c \u0435\u043c\u0443 \u0432 <code>HexGrid.CreateCell<\/code> \u0446\u0432\u0435\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code class=\"cs\">\tvoid CreateCell (int x, int z, int i) { \t\t\u2026 \t\tcell.coordinates = HexCoordinates.FromOffsetCoordinates(x, z); \t\tcell.color = defaultColor; \t\t\u2026 \t}<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a <code>HexMesh<\/code> \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0446\u0432\u0435\u0442\u0435.<\/p>\n<pre><code class=\"cs\">\tList&lt;Color&gt; colors;  \tvoid Awake () { \t\t\u2026 \t\tvertices = new List&lt;Vector3&gt;(); \t\tcolors = new List&lt;Color&gt;(); \t\t\u2026 \t}  \tpublic void Triangulate (HexCell[] cells) { \t\thexMesh.Clear(); \t\tvertices.Clear(); \t\tcolors.Clear(); \t\t\u2026 \t\thexMesh.vertices = vertices.ToArray(); \t\thexMesh.colors = colors.ToArray(); \t\t\u2026 \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0443 \u0435\u0449\u0451 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0446\u0432\u0435\u0442\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<pre><code class=\"cs\">\tvoid Triangulate (HexCell cell) { \t\tVector3 center = cell.transform.localPosition; \t\tfor (int i = 0; i &lt; 6; i++) { \t\t\tAddTriangle( \t\t\t\tcenter, \t\t\t\tcenter + HexMetrics.corners[i], \t\t\t\tcenter + HexMetrics.corners[i + 1] \t\t\t); \t\t\tAddTriangleColor(cell.color); \t\t} \t}  \tvoid AddTriangleColor (Color color) { \t\tcolors.Add(color); \t\tcolors.Add(color); \t\tcolors.Add(color); \t}<\/code><\/pre>\n<p>  \u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a <code>HexGrid.TouchCell<\/code>. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0414\u043b\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0438 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e X \u043f\u043b\u044e\u0441 Z \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0448\u0438\u0440\u0438\u043d\u0443, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451 \u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 Z. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0431\u0435\u0440\u0451\u043c \u044f\u0447\u0435\u0439\u043a\u0443, \u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0451 \u0446\u0432\u0435\u0442 \u0438 \u0441\u043d\u043e\u0432\u0430 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u043c\u0435\u0448.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043d\u043e\u0432\u043e \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043c\u0435\u0448?<\/b><\/p>\n<div class=\"spoiler_text\">\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u0443\u043c\u043d\u0435\u0435, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439. \u0412 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 \u043c\u0435\u0448 \u0441\u0442\u0430\u043d\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u041b\u044e\u0431\u044b\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u044f \u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0435\u0439\u0447\u0430\u0441, \u043c\u043e\u0433\u0443\u0442 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u043c\u0438. \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0433\u0440\u0443\u0431\u043e\u0439 \u0441\u0438\u043b\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/div>\n<\/div>\n<p>  <\/p>\n<pre><code class=\"cs\">\tpublic void TouchCell (Vector3 position) { \t\tposition = transform.InverseTransformPoint(position); \t\tHexCoordinates coordinates = HexCoordinates.FromPosition(position); \t\tint index = coordinates.X + coordinates.Z * width + coordinates.Z \/ 2; \t\tHexCell cell = cells[index]; \t\tcell.color = touchedColor; \t\thexMesh.Triangulate(cells); \t}<\/code><\/pre>\n<p>  \u0425\u043e\u0442\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438 \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438, \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u0438\u0434\u043d\u043e. \u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0448\u0435\u0439\u0434\u0435\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0446\u0432\u0435\u0442\u0430 \u0432\u0435\u0440\u0448\u0438\u043d. \u041d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 default shader (<i>Assets \/ Create \/ Shader \/ Default Surface Shader<\/i>). \u0412 \u043d\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u0435\u0433\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0439 struct \u0434\u0430\u043d\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0443\u043c\u043d\u043e\u0436\u0438\u043c albedo \u043d\u0430 \u044d\u0442\u043e\u0442 \u0446\u0432\u0435\u0442. \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043d\u0430\u043b\u044b RGB, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u0435\u043d.<\/p>\n<pre><code>Shader \"Custom\/VertexColors\" { \tProperties { \t\t_Color (\"Color\", Color) = (1,1,1,1) \t\t_MainTex (\"Albedo (RGB)\", 2D) = \"white\" {} \t\t_Glossiness (\"Smoothness\", Range(0,1)) = 0.5 \t\t_Metallic (\"Metallic\", Range(0,1)) = 0.0 \t} \tSubShader { \t\tTags { \"RenderType\"=\"Opaque\" } \t\tLOD 200 \t\t \t\tCGPROGRAM \t\t#pragma surface surf Standard fullforwardshadows \t\t#pragma target 3.0  \t\tsampler2D _MainTex;  \t\tstruct Input { \t\t\tfloat2 uv_MainTex; \t\t\t&lt;mark&gt;float4 color : COLOR;&lt;\/mark&gt; \t\t};  \t\thalf _Glossiness; \t\thalf _Metallic; \t\tfixed4 _Color;  \t\tvoid surf (Input IN, inout SurfaceOutputStandard o) { \t\t\tfixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; \t\t\to.Albedo = c.rgb &lt;mark&gt;* IN.color&lt;\/mark&gt;; \t\t\to.Metallic = _Metallic; \t\t\to.Smoothness = _Glossiness; \t\t\to.Alpha = c.a; \t\t} \t\tENDCG \t} \tFallBack \"Diffuse\" }<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u043e\u0442 \u0448\u0435\u0439\u0434\u0435\u0440, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u0448 \u0441\u0435\u0442\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u044d\u0442\u043e\u0442 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0446\u0432\u0435\u0442\u0430 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/223\/efe\/be1\/223efebe1bdda83c9b383dac32197c6e.png\"><\/div>\n<p>  <i>\u0420\u0430\u0441\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0435 \u044f\u0447\u0435\u0439\u043a\u0438.<\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0423 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b \u0442\u0435\u043d\u0435\u0439!<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Unity \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0442\u0435\u043d\u044f\u043c\u0438. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0434\u0438\u0437\u0435\u0440\u0438\u043d\u0433 \u0438\u043b\u0438 \u043f\u043e\u043b\u043e\u0441\u044b \u043d\u0430 \u0442\u0435\u043d\u044f\u0445, \u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 Z-\u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u043d\u0438 \u043e\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f.<\/div>\n<\/div>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-1\/interaction\/interaction.unitypackage\">unitypackage<\/a><\/p>\n<h2>\u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043a\u0430\u0440\u0442\u044b<\/h2>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0438\u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440. \u042d\u0442\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 <code>HexGrid<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043c <code>TouchCell<\/code> \u0432 \u043e\u0431\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0446\u0432\u0435\u0442\u0430. \u0422\u0430\u043a\u0436\u0435 \u0443\u0434\u0430\u043b\u0438\u043c \u043f\u043e\u043b\u0435 <code>touchedColor<\/code>.<\/p>\n<pre><code class=\"cs\">public void ColorCell (Vector3 position, Color color) { \t\tposition = transform.InverseTransformPoint(position); \t\tHexCoordinates coordinates = HexCoordinates.FromPosition(position); \t\tint index = coordinates.X + coordinates.Z * width + coordinates.Z \/ 2; \t\tHexCell cell = cells[index]; \t\tcell.color = color; \t\thexMesh.Triangulate(cells); \t}<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>HexMapEditor<\/code> \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u044b <code>Update<\/code> \u0438 <code>HandleInput<\/code>. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u043c\u0443 \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u043b\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0442\u043a\u0443 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u043c\u0430\u0441\u0441\u0438\u0432 \u0446\u0432\u0435\u0442\u043e\u0432 \u0438 \u0447\u0430\u0441\u0442\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u0446\u0432\u0435\u0442\u0430 \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0446\u0432\u0435\u0442.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public class HexMapEditor : MonoBehaviour {  \tpublic Color[] colors;  \tpublic HexGrid hexGrid;  \tprivate Color activeColor;  \tvoid Awake () { \t\tSelectColor(0); \t}  \tvoid Update () { \t\tif (Input.GetMouseButton(0)) { \t\t\tHandleInput(); \t\t} \t}  \tvoid HandleInput () { \t\tRay inputRay = Camera.main.ScreenPointToRay(Input.mousePosition); \t\tRaycastHit hit; \t\tif (Physics.Raycast(inputRay, out hit)) { \t\t\thexGrid.ColorCell(hit.point, activeColor); \t\t} \t}  \tpublic void SelectColor (int index) { \t\tactiveColor = colors[index]; \t} }<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d canvas, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a \u043d\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>HexMapEditor<\/code>, \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0446\u0432\u0435\u0442\u043e\u0432 \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u0435 \u0441 \u0441\u0435\u0442\u043a\u043e\u0439 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 event system, \u0438 \u043e\u043d \u0441\u043d\u043e\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u043b\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d18\/0d6\/be4\/d180d6be4c656688f4ec6c4f5789bdba.png\"><\/div>\n<p>  <i>\u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043a\u0430\u0440\u0442\u044b \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0441 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u0446\u0432\u0435\u0442\u0430\u043c\u0438.<\/i><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430 canvas \u043f\u0430\u043d\u0435\u043b\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0446\u0432\u0435\u0442\u0430 (<i>GameObject \/ UI \/ Panel<\/i>). \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0439 toggle group (<i>Components \/ UI\/ Toggle Group<\/i>). \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0430\u043d\u0435\u043b\u044c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0451 \u0432 \u0443\u0433\u043b\u0443 \u044d\u043a\u0440\u0430\u043d\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/63f\/b05\/4db\/63fb054dbb5c64fce6c4671283df6e6a.png\"><\/div>\n<p>  <i>\u041f\u0430\u043d\u0435\u043b\u044c \u0446\u0432\u0435\u0442\u043e\u0432 \u0441 toggle group.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0430\u043d\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 (<i>GameObject \/ UI \/ Toggle<\/i>). \u041f\u043e\u043a\u0430 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0443\u0442\u0440\u0443\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e UI, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0440\u0443\u0447\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/eef\/40e\/ffc\/eef40effcb9510ba924186b766a1fee0.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d58\/0e4\/595\/d580e45954552b134082a9379af2eb8c.png\"><\/div>\n<p>  <i>\u041f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044e \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0446\u0432\u0435\u0442.<\/i><\/p>\n<p>  \u0412\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c. \u0422\u0430\u043a\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u0438 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 toggle group, \u0447\u0442\u043e\u0431\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0438\u0445 \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <code>SelectColor<\/code> \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u043e\u0439 &#171;+&#187; UI \u0441\u043e\u0431\u044b\u0442\u0438\u044f <i>On Value Changed<\/i>. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u043a\u0430\u0440\u0442, \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0441\u043f\u0438\u0441\u043a\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7b4\/e05\/0af\/7b4e050afca862a244607248834676aa.png\"><\/div>\n<p>  <i>\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c.<\/i><\/p>\n<p>  \u042d\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0431\u0443\u043b\u0435\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439, \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438. \u041d\u043e \u043d\u0430\u0441 \u044d\u0442\u043e \u043d\u0435 \u0432\u043e\u043b\u043d\u0443\u0435\u0442. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0446\u0432\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0, \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1, \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0433\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f?<\/b><\/p>\n<div class=\"spoiler_text\">\u041c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044f. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u0431\u0443\u043b\u0435\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0442\u043e \u043e\u043d \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043d\u0430\u043c, \u0432\u043a\u043b\u044e\u0447\u0451\u043d \u043b\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c.<\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0433\u0440\u0443\u043f\u043f\u044b, \u0432\u044b\u0431\u043e\u0440 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e <code>SelectColor<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0432\u0430\u0436\u0434\u044b. \u042d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u0437\u043e\u0432.<\/div>\n<\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/35a\/0bb\/8f4\/35a0bb8f4425b0c821836f9aa9afda16.png\"><\/div>\n<p>  <i>\u0420\u0430\u0441\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0446\u0432\u0435\u0442\u0430\u043c\u0438.<\/i><\/p>\n<p>  \u0425\u043e\u0442\u044f UI \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u044e\u0449\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c. \u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0435\u0451, \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u043f\u0430\u043d\u0435\u043b\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u043b\u0430 \u0441\u0435\u0442\u043a\u0443 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u041f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u043f\u043e\u0434 UI. \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u0441 UI \u0438 \u0441 \u0441\u0435\u0442\u043a\u043e\u0439. \u042d\u0442\u043e \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0430 \u043b\u0438 \u043e\u043d\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043d\u0430\u0434 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c. \u0422\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u0437\u043d\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 UI, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0430\u0442\u044c \u043d\u0430\u043c, \u0447\u0442\u043e \u043c\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u0441 UI. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0432\u043e\u0434 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<pre><code class=\"cs\">using UnityEngine; using UnityEngine.EventSystems; \t \t\u2026 \t \tvoid Update () { \t\tif ( \t\t\tInput.GetMouseButton(0) &amp;&amp; \t\t\t!EventSystem.current.IsPointerOverGameObject() \t\t) { \t\t\tHandleInput(); \t\t} \t}<\/code><\/pre>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-1\/map-editor\/map-editor.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c 2: \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432 \u044f\u0447\u0435\u0435\u043a<\/h1>\n<p>  <\/p>\n<h2>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0441\u043e\u0441\u0435\u0434\u0435\u0439.<\/li>\n<li>\u0418\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0446\u0432\u0435\u0442\u0430 \u043c\u0435\u0436\u0434\u0443 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f.<\/li>\n<li>\u0423\u043f\u0440\u043e\u0449\u0430\u0435\u043c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044e.<\/li>\n<\/ul>\n<p>  \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0437\u0430\u043b\u043e\u0436\u0438\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u0441\u0435\u0442\u043a\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0447\u0435\u0435\u043a. \u041a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 \u0441\u043f\u043b\u043e\u0448\u043d\u043e\u0439 \u0446\u0432\u0435\u0442 \u0438 \u0446\u0432\u0435\u0442\u0430 \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u0445 \u044f\u0447\u0435\u0435\u043a \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u0437\u043a\u043e. \u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043e\u043d\u044b, \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u044f\u0447\u0435\u0435\u043a.<br \/>  <cut><\/cut>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8ca\/518\/132\/8ca518132084099a6159027d4a345710.png\"><\/div>\n<p>  <i>\u0421\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u043c\u0435\u0436\u0434\u0443 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438.<\/i><\/p>\n<h2>\u0421\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438<\/h2>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u044f\u0447\u0435\u0435\u043a, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u0437 \u044f\u0447\u0435\u0435\u043a \u0441\u043e\u0441\u0435\u0434\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. \u0423 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u0435\u0441\u0442\u044c \u0448\u0435\u0441\u0442\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u043f\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c \u0441\u0442\u043e\u0440\u043e\u043d \u0441\u0432\u0435\u0442\u0430. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f: \u0441\u0435\u0432\u0435\u0440\u043e-\u0432\u043e\u0441\u0442\u043e\u043a, \u0432\u043e\u0441\u0442\u043e\u043a, \u044e\u0433\u043e-\u0432\u043e\u0441\u0442\u043e\u043a, \u044e\u0433\u043e-\u0437\u0430\u043f\u0430\u0434, \u0437\u0430\u043f\u0430\u0434 \u0438 \u0441\u0435\u0432\u0435\u0440\u043e-\u0437\u0430\u043f\u0430\u0434. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043b\u044f \u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/p>\n<pre><code class=\"cs\">public enum HexDirection { \tNE, E, SE, SW, W, NW }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 enum?<\/b><\/p>\n<div class=\"spoiler_text\"><code>enum<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0438\u043c\u0451\u043d. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e \u0438\u0437 \u044d\u0442\u0438\u0445 \u0438\u043c\u0451\u043d. \u041a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0438\u043c\u0451\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0447\u0438\u0441\u043b\u0443, \u0441\u0447\u0451\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0443\u043b\u044f. \u041e\u043d\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u043c\u0451\u043d.<\/p>\n<p>  \u0412\u043d\u0443\u0442\u0440\u0438 enum \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430. \u041c\u043e\u0436\u043d\u043e \u0438\u0445 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c, \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432 integer \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u0442\u0438\u043f\u043e\u043c, \u043d\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f integer.<\/p><\/div>\n<\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/181\/e0e\/37f\/181e0e37fdd59ab37214cc909409351c.png\"><\/div>\n<p>  <i>\u0428\u0435\u0441\u0442\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439, \u0448\u0435\u0441\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439.<\/i><\/p>\n<p>  \u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a <code>HexCell<\/code> \u043c\u0430\u0441\u0441\u0438\u0432. \u0425\u043e\u0442\u044c \u043c\u044b \u0438 \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0431\u0449\u0438\u043c, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u043d\u044b\u043c \u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439. \u0422\u0430\u043a\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0432\u044f\u0437\u0438 \u043d\u0435 \u0442\u0435\u0440\u044f\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<pre><code class=\"cs\">\t[SerializeField] \tHexCell[] neighbors;<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0443\u0436\u043d\u043e \u043b\u0438 \u043d\u0430\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0441\u043e\u0441\u0435\u0434\u044f\u043c\u0438?<\/b><\/p>\n<div class=\"spoiler_text\">\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u0438\u0437 \u0441\u0435\u0442\u043a\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0435\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e.<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0435. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u0435\u0441\u0442\u044c \u043f\u043e \u0448\u0435\u0441\u0442\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439, \u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u0444\u0430\u0431\u0430 <i>Hex Cell<\/i> \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 6.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6ef\/8c1\/a2e\/6ef8c1a2ee9478b007faefcef2516934.png\"><\/div>\n<p>  <i>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0435\u0444\u0430\u0431\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0448\u0435\u0441\u0442\u0438 \u0441\u043e\u0441\u0435\u0434\u0435\u0439.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0435\u0434\u0430 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u043e\u0442 0 \u0434\u043e 5, \u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<pre><code class=\"cs\">\tpublic HexCell GetNeighbor (HexDirection direction) { \t\treturn neighbors[(int)direction]; \t}<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0436\u0435 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0441\u0435\u0434\u0430.<\/p>\n<pre><code class=\"cs\">\tpublic void SetNeighbor (HexDirection direction, HexCell cell) { \t\tneighbors[(int)direction] = cell; \t}<\/code><\/pre>\n<p>  \u041e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0438 \u0441\u043e\u0441\u0435\u0434\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0435\u0434\u0430 \u0438 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<pre><code class=\"cs\">\tpublic void SetNeighbor (HexDirection direction, HexCell cell) { \t\tneighbors[(int)direction] = cell; \t\tcell.neighbors[(int)direction.Opposite()] = this; \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b86\/616\/15c\/b8661615ceece04f7f4c16fa1c032be4.png\"><\/div>\n<p>  <i>\u0421\u043e\u0441\u0435\u0434\u0438 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445.<\/i><\/p>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0430. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u0441\u043e\u0437\u0434\u0430\u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f <code>HexDirection<\/code>. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 3. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u044b\u0445 \u0442\u0440\u0451\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439, \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c 3.<\/p>\n<pre><code class=\"cs\">public enum HexDirection { \tNE, E, SE, SW, W, NW }  public static class HexDirectionExtensions {  \tpublic static HexDirection Opposite (this HexDirection direction) { \t\treturn (int)direction &lt; 3 ? (direction + 3) : (direction - 3); \t} }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 (extension method)?<\/b><\/p>\n<div class=\"spoiler_text\">\u0420\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u2014 \u044d\u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u043c\u0435\u0442\u043e\u0434 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0442\u0438\u043f\u0430. \u042d\u0442\u043e\u0442 \u0442\u0438\u043f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a\u0438\u043c \u0443\u0433\u043e\u0434\u043d\u043e \u2014 \u043a\u043b\u0430\u0441\u0441\u043e\u043c, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>this<\/code>. \u041e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434.<\/p>\n<p>  \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0438 \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u043a \u0447\u0435\u043c\u0443 \u0443\u0433\u043e\u0434\u043d\u043e? \u0414\u0430, \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043b\u044e\u0431\u043e\u0439 \u0442\u0438\u043f. \u0425\u043e\u0440\u043e\u0448\u0430\u044f \u043b\u0438 \u044d\u0442\u043e \u0438\u0434\u0435\u044f? \u041f\u0440\u0438 \u0443\u043c\u0435\u0440\u0435\u043d\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u042d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043d\u043e \u043f\u0440\u0438 \u0447\u0440\u0435\u0437\u043c\u0435\u0440\u043d\u043e\u043c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0445\u0430\u043e\u0441.<\/p><\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/h3>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0432 <code>HexGrid.CreateCell<\/code>. \u041f\u0440\u0438 \u043e\u0431\u0445\u043e\u0434\u0435 \u044f\u0447\u0435\u0435\u043a \u0441\u0442\u0440\u043e\u043a\u0430 \u0437\u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0441\u043b\u0435\u0432\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043e, \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b. \u042d\u0442\u043e \u044f\u0447\u0435\u0439\u043a\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 E\u2013W. \u041f\u0435\u0440\u0432\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0441\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0430. \u041d\u043e \u0443 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u044f\u0447\u0435\u0435\u043a \u043e\u043d \u0435\u0441\u0442\u044c. \u0418 \u044d\u0442\u0438 \u0441\u043e\u0441\u0435\u0434\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u043e \u044f\u0447\u0435\u0439\u043a\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/787\/3bf\/16f\/7873bf16fdecde4ff216cc30b206ce89.png\"><\/div>\n<p>  <i>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438\u0437 E \u0432 W \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044f\u0447\u0435\u0435\u043a.<\/i><\/p>\n<pre><code class=\"cs\">\tvoid CreateCell (int x, int z, int i) { \t\t\u2026 \t\tcell.color = defaultColor;  \t\tif (x &gt; 0) { \t\t\tcell.SetNeighbor(HexDirection.W, cells[i - 1]); \t\t}  \t\tText label = Instantiate&lt;Text&gt;(cellLabelPrefab); \t\t\u2026 \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/560\/08e\/8b6\/56008e8b6b2c16f3da710a2cedebb7dd.png\"><\/div>\n<p>  <i>\u0412\u043e\u0441\u0442\u043e\u0447\u043d\u044b\u0439 \u0438 \u0437\u0430\u043f\u0430\u0434\u043d\u044b\u0439 \u0441\u043e\u0441\u0435\u0434 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u044b.<\/i><\/p>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0449\u0451 \u0434\u0432\u0430 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0441\u0435\u0442\u043a\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<pre><code class=\"cs\">\t\tif (x &gt; 0) { \t\t\tcell.SetNeighbor(HexDirection.W, cells[i - 1]); \t\t} \t\tif (z &gt; 0) { \t\t}<\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0434\u0443\u0442 \u0437\u0438\u0433\u0437\u0430\u0433\u043e\u043c, \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0441 \u0447\u0451\u0442\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0438\u043c\u0435\u044e\u0442 \u0441\u043e\u0441\u0435\u0434\u0430 \u043d\u0430 SE, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0438\u0445 \u0441 \u043d\u0438\u043c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7d5\/e56\/419\/7d5e56419ed4a0fb7b2c506061543561.png\"><\/div>\n<p>  <i>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438\u0437 NW \u0432 SE \u0434\u043b\u044f \u0447\u0451\u0442\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a.<\/i><\/p>\n<pre><code class=\"cs\">\t\tif (z &gt; 0) { \t\t\tif ((z &amp; 1) == 0) { \t\t\t\tcell.SetNeighbor(HexDirection.SE, cells[i - width]); \t\t\t} \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 z &amp; 1?<\/b><\/p>\n<div class=\"spoiler_text\"><code>&amp;&amp;<\/code> \u2014 \u044d\u0442\u043e \u0431\u0443\u043b\u0435\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0418, \u0430 <code>&amp;<\/code> \u2014 \u044d\u0442\u043e \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0418. \u041e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u0443 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443, \u043d\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0430\u0440\u0443 \u043a\u0430\u0436\u0434\u044b\u0445 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432. \u0422\u043e \u0435\u0441\u0442\u044c \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0432\u043d\u044f\u043b\u0441\u044f 1, \u043e\u0431\u0430 \u0431\u0438\u0442\u0430 \u043f\u0430\u0440\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c 1. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>10101010 &amp; 00001111<\/code> \u0434\u0430\u0451\u0442 <code>00001010<\/code>.<\/p>\n<p>  \u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u0434\u0432\u043e\u0438\u0447\u043d\u044b. \u041e\u043d\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e 0 \u0438 1. \u0412 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0440\u044f\u0434 1, 2, 3, 4 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a 1, 10, 11, 100. \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432 \u0447\u0451\u0442\u043d\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u043c \u0431\u0438\u0442\u043e\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f 0.<\/p>\n<p>  \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0435 \u0418 \u043a\u0430\u043a \u043c\u0430\u0441\u043a\u0443, \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044f \u0432\u0441\u0451, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0431\u0438\u0442\u0430. \u0415\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0432\u0435\u043d 0, \u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0447\u0451\u0442\u043d\u043e\u0435.<\/p><\/div>\n<\/div>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u0438 \u0441 \u0441\u043e\u0441\u0435\u0434\u044f\u043c\u0438 \u043d\u0430 SW, \u043a\u0440\u043e\u043c\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0433\u043e \u043d\u0435\u0442.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ed1\/f7a\/73c\/ed1f7a73c9e09970a041e4596668626b.png\"><\/div>\n<p>  <i>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438\u0437 NE \u0432 SW \u0434\u043b\u044f \u0447\u0451\u0442\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a.<\/i><\/p>\n<pre><code class=\"cs\">\t\tif (z &gt; 0) { \t\t\tif ((z &amp; 1) == 0) { \t\t\t\tcell.SetNeighbor(HexDirection.SE, cells[i - width]); \t\t\t\tif (x &gt; 0) { \t\t\t\t\tcell.SetNeighbor(HexDirection.SW, cells[i - width - 1]); \t\t\t\t} \t\t\t} \t\t}<\/code><\/pre>\n<p>  \u041d\u0435\u0447\u0451\u0442\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0442\u043e\u0439 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0435, \u043d\u043e \u0432 \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432\u0441\u0435 \u0441\u043e\u0441\u0435\u0434\u0438 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u043a\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u043c\u0438.<\/p>\n<pre><code class=\"cs\">\t\tif (z &gt; 0) { \t\t\tif ((z &amp; 1) == 0) { \t\t\t\tcell.SetNeighbor(HexDirection.SE, cells[i - width]); \t\t\t\tif (x &gt; 0) { \t\t\t\t\tcell.SetNeighbor(HexDirection.SW, cells[i - width - 1]); \t\t\t\t} \t\t\t} \t\t\telse { \t\t\t\tcell.SetNeighbor(HexDirection.SW, cells[i - width]); \t\t\t\tif (x &lt; width - 1) { \t\t\t\t\tcell.SetNeighbor(HexDirection.SE, cells[i - width + 1]); \t\t\t\t} \t\t\t} \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/00b\/eee\/ff1\/00beeeff163b36232bd37f6076c34c90.png\"><\/div>\n<p>  <i>\u0412\u0441\u0435 \u0441\u043e\u0441\u0435\u0434\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u044b.<\/i><\/p>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043d\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0430 \u0440\u043e\u0432\u043d\u043e \u0441 \u0448\u0435\u0441\u0442\u044c\u044e \u0441\u043e\u0441\u0435\u0434\u044f\u043c\u0438. \u0423 \u044f\u0447\u0435\u0435\u043a \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \u0441\u0435\u0442\u043a\u0438 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0432\u0443\u0445 \u0438 \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u044f\u0442\u0438 \u0441\u043e\u0441\u0435\u0434\u0435\u0439. \u0418 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e7a\/4a9\/1c5\/e7a4a91c55e7cc2574eed105f7b9a110.png\"><\/div>\n<p>  <i>\u0421\u043e\u0441\u0435\u0434\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438.<\/i><\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-2\/cell-neighbors\/cell-neighbors.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432<\/h2>\n<p>  \u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432 \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u0442 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u043a\u043e\u0434 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c. \u0422\u0430\u043a \u043a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0445, \u0430 \u043d\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b.<\/p>\n<pre><code class=\"cs\">\tvoid Triangulate (HexCell cell) { \t\tfor (HexDirection d = HexDirection.NE; d &lt;= HexDirection.NW; d++) { \t\t\tTriangulate(d, cell); \t\t} \t}  \tvoid Triangulate (HexDirection direction, HexCell cell) { \t\tVector3 center = cell.transform.localPosition; \t\tAddTriangle( \t\t\tcenter, \t\t\tcenter + HexMetrics.corners[(int)direction], \t\t\tcenter + HexMetrics.corners[(int)direction + 1] \t\t); \t\tAddTriangleColor(cell.color); \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0431\u044b\u043b\u043e \u0431\u044b \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u0433\u043b\u044b \u0441 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438, \u0430 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u044b.<\/p>\n<pre><code class=\"cs\">\t\tAddTriangle( \t\t\tcenter, \t\t\tcenter + HexMetrics.GetFirstCorner(direction), \t\t\tcenter + HexMetrics.GetSecondCorner(direction) \t\t);<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 <code>HexMetrics<\/code> \u0434\u0432\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u0430. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u043e\u043d\u0443\u0441\u0430 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0443\u0433\u043b\u043e\u0432 \u0447\u0430\u0441\u0442\u043d\u044b\u043c.<\/p>\n<pre><code class=\"cs\">\tstatic Vector3[] corners = { \t\tnew Vector3(0f, 0f, outerRadius), \t\tnew Vector3(innerRadius, 0f, 0.5f * outerRadius), \t\tnew Vector3(innerRadius, 0f, -0.5f * outerRadius), \t\tnew Vector3(0f, 0f, -outerRadius), \t\tnew Vector3(-innerRadius, 0f, -0.5f * outerRadius), \t\tnew Vector3(-innerRadius, 0f, 0.5f * outerRadius), \t\tnew Vector3(0f, 0f, outerRadius) \t};  \tpublic static Vector3 GetFirstCorner (HexDirection direction) { \t\treturn corners[(int)direction]; \t}  \tpublic static Vector3 GetSecondCorner (HexDirection direction) { \t\treturn corners[(int)direction + 1]; \t}<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0446\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a<\/h3>\n<p>  \u041f\u043e\u043a\u0430 \u0443 \u043c\u0435\u0442\u043e\u0434\u0430 <code>HexMesh.AddTriangleColor<\/code> \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0446\u0432\u0435\u0442\u0430. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e \u0441\u043f\u043b\u043e\u0448\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0443, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0443\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b.<\/p>\n<pre><code class=\"cs\">\tvoid AddTriangleColor (Color c1, Color c2, Color c3) { \t\tcolors.Add(c1); \t\tcolors.Add(c2); \t\tcolors.Add(c3); \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044e \u0446\u0432\u0435\u0442\u043e\u0432! \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430 \u0441\u043e\u0441\u0435\u0434\u0430 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0440\u0448\u0438\u043d.<\/p>\n<pre><code class=\"cs\">\tvoid Triangulate (HexDirection direction, HexCell cell) { \t\tVector3 center = cell.transform.localPosition; \t\tAddTriangle( \t\t\tcenter, \t\t\tcenter + HexMetrics.GetFirstCorner(direction), \t\t\tcenter + HexMetrics.GetSecondCorner(direction) \t\t); \t\tHexCell neighbor = cell.GetNeighbor(direction); \t\tAddTriangleColor(cell.color, neighbor.color, neighbor.color); \t}<\/code><\/pre>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a <code>NullReferenceException<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u044f\u0447\u0435\u0435\u043a \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \u043d\u0435\u0442 \u0448\u0435\u0441\u0442\u0438 \u0441\u043e\u0441\u0435\u0434\u0435\u0439. \u041a\u0430\u043a \u043d\u0430\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043f\u0440\u0438 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0435 \u0441\u043e\u0441\u0435\u0434\u0430? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0430\u0433\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u043c\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043c\u0435\u043d\u044b \u0441\u0430\u043c\u0443 \u044f\u0447\u0435\u0439\u043a\u0443.<\/p>\n<pre><code class=\"cs\">\t\tHexCell neighbor = cell.GetNeighbor(direction) ?? cell;<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 ??<\/b><\/p>\n<div class=\"spoiler_text\">\u042d\u0442\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f null-coalescing operator. \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e, \u0442\u043e <code>a ?? b<\/code> \u2014 \u044d\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u0434\u043b\u044f <code>a != null ? a : b<\/code>.<\/p>\n<p>  \u0422\u0443\u0442 \u0435\u0441\u0442\u044c \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0447\u0435\u0433\u043e-\u0442\u043e \u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438 Unity \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443. \u042d\u0442\u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043c\u0438\u043d\u0443\u0435\u0442 \u0442\u0430\u043a\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0447\u0435\u0441\u0442\u043d\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 <code>null<\/code>. \u041d\u043e \u044d\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/div>\n<\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/375\/558\/667\/3755586675e7126b25e776f1283ec8b5.png\"><\/div>\n<p>  <i>\u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432 \u0435\u0441\u0442\u044c, \u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e.<\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0443\u0434\u0430 \u0434\u0435\u043b\u0438\u0441\u044c \u043c\u0435\u0442\u043a\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442?<\/b><\/p>\n<div class=\"spoiler_text\">\u041e\u043d\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u043d\u043e \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u043e\u0432 \u044f \u0441\u043a\u0440\u044b\u043b \u0441\u043b\u043e\u0439 UI.<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0423\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432<\/h3>\n<p>  \u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u044b. \u0426\u0432\u0435\u0442 \u043d\u0430 \u0440\u0451\u0431\u0440\u0430\u0445 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u043e\u0442 \u0434\u0432\u0443\u0445 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<pre><code class=\"cs\">\t\tHexCell neighbor = cell.GetNeighbor(direction) ?? cell; \t\tColor edgeColor = (cell.color + neighbor.color) * 0.5f; \t\tAddTriangleColor(cell.color, edgeColor, edgeColor);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/aff\/079\/b26\/aff079b261e39c1959d004c0ddf3a58f.png\"><\/div>\n<p>  <i>\u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0440\u0451\u0431\u0440\u0430\u0445.<\/i><br \/>  \u0425\u043e\u0442\u044f \u043c\u044b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0440\u0451\u0431\u0440\u0430\u0445, \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u0437\u043a\u0438\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0446\u0432\u0435\u0442\u043e\u0432. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0435\u0439 \u0434\u043b\u044f \u0442\u0440\u0451\u0445 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/19e\/8f2\/507\/19e8f2507f011213c1514ea20ce04906.png\"><\/div>\n<p>  <i>\u0422\u0440\u0438 \u0441\u043e\u0441\u0435\u0434\u0430, \u0447\u0435\u0442\u044b\u0440\u0435 \u0446\u0432\u0435\u0442\u0430.<\/i><\/p>\n<p>  \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445. \u0422\u043e \u0435\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435 \u0446\u0432\u0435\u0442\u0430 \u0432 \u0434\u0432\u0443\u0445 \u043d\u0430\u0431\u043e\u0440\u0430\u0445 \u043f\u043e \u0442\u0440\u0438.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>HexDirectionExtensions<\/code> \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c.<\/p>\n<pre><code class=\"cs\">\tpublic static HexDirection Previous (this HexDirection direction) { \t\treturn direction == HexDirection.NE ? HexDirection.NW : (direction - 1); \t}  \tpublic static HexDirection Next (this HexDirection direction) { \t\treturn direction == HexDirection.NW ? HexDirection.NE : (direction + 1); \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0442\u0440\u0451\u0445\u0441\u0442\u043e\u0440\u043e\u043d\u0435\u0435 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"cs\">\t\tHexCell prevNeighbor = cell.GetNeighbor(direction.Previous()) ?? cell; \t\tHexCell neighbor = cell.GetNeighbor(direction) ?? cell; \t\tHexCell nextNeighbor = cell.GetNeighbor(direction.Next()) ?? cell; \t\t \t\tAddTriangleColor( \t\t\tcell.color, \t\t\t(cell.color + prevNeighbor.color + neighbor.color) \/ 3f, \t\t\t(cell.color + neighbor.color + nextNeighbor.color) \/ 3f \t\t);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/430\/b19\/778\/430b197786bb2bde51fb528946561733.png\"><\/div>\n<p>  <i>\u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0433\u043b\u0430\u0445.<\/i><\/p>\n<p>  \u0422\u0430\u043a \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u0446\u0432\u0435\u0442\u043e\u0432, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0435\u0442\u043a\u0438. \u042f\u0447\u0435\u0439\u043a\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f \u0441 \u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0432\u0438\u0434\u0438\u043c \u0440\u0435\u0437\u043a\u0438\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u0430\u0448 \u043d\u044b\u043d\u0435\u0448\u043d\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0434\u0430\u0451\u0442 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0448\u0435.<\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-2\/blending-colors\/blending-colors.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u041e\u0431\u043b\u0430\u0441\u0442\u0438 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f<\/h2>\n<p>  \u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e \u0432\u0441\u0435\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0440\u0430\u0437\u043c\u044b\u0442\u043e\u043c\u0443 \u0445\u0430\u043e\u0441\u0443. \u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0447\u0451\u0442\u043a\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u044f\u0447\u0435\u0439\u043a\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u044f\u0434\u043e\u043c \u0441 \u0440\u0451\u0431\u0440\u0430\u043c\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u043f\u043b\u043e\u0448\u043d\u0443\u044e \u043e\u043a\u0440\u0430\u0441\u043a\u0443.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/53e\/82a\/ff6\/53e82aff62f060a51ef5645accd45d03.png\"><\/div>\n<p>  <i>\u0421\u043f\u043b\u043e\u0448\u043d\u0430\u044f \u0437\u0430\u043a\u0440\u0430\u0441\u043a\u0430 \u0446\u0435\u043d\u0442\u043e\u0432 \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f.<\/i><\/p>\n<p>  \u041a\u0430\u043a\u0438\u043c \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043f\u043b\u043e\u0448\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f? \u0420\u0430\u0437\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0440\u0430\u0437\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c. \u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u044d\u0442\u0443 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043a\u0430\u043a \u0434\u043e\u043b\u044e \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0440\u0430\u0434\u0438\u0443\u0441\u0430. \u041f\u0443\u0441\u0442\u044c \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 75%. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043d\u0430\u0441 \u043a \u0434\u0432\u0443\u043c \u043d\u043e\u0432\u044b\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c, \u0432 \u0441\u0443\u043c\u043c\u0435 \u0434\u0430\u044e\u0449\u0438\u043c 100%.<\/p>\n<pre><code class=\"cs\">\tpublic const float solidFactor = 0.75f; \t \tpublic const float blendFactor = 1f - solidFactor;<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0432 \u044d\u0442\u043e\u0442 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441\u043f\u043b\u043e\u0448\u043d\u043e\u0439 \u0437\u0430\u043a\u0440\u0430\u0441\u043a\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u0433\u043b\u043e\u0432 \u0441\u043f\u043b\u043e\u0448\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/p>\n<pre><code class=\"cs\">\tpublic static Vector3 GetFirstSolidCorner (HexDirection direction) { \t\treturn corners[(int)direction] * solidFactor; \t}  \tpublic static Vector3 GetSecondSolidCorner (HexDirection direction) { \t\treturn corners[(int)direction + 1] * solidFactor; \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u043c <code>HexMesh.Triangulate<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0443\u0433\u043b\u043e\u0432 \u044d\u0442\u0438 \u0443\u0433\u043b\u044b \u0441\u043f\u043b\u043e\u0448\u043d\u043e\u0439 \u0437\u0430\u043a\u0440\u0430\u0441\u043a\u0438. \u0426\u0432\u0435\u0442\u0430 \u043f\u043e\u043a\u0430 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435.<\/p>\n<pre><code class=\"cs\">\t\tAddTriangle( \t\t\tcenter, \t\t\tcenter + HexMetrics.GetFirstSolidCorner(direction), \t\t\tcenter + HexMetrics.GetSecondSolidCorner(direction) \t\t);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d40\/eb5\/326\/d40eb5326b0e0457e55ae2752897efc9.png\"><\/div>\n<p>  <i>\u0421\u043f\u043b\u043e\u0448\u043d\u044b\u0435 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0431\u0435\u0437 \u0440\u0451\u0431\u0435\u0440.<\/i><\/p>\n<h3>\u0422\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f<\/h3>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0440\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u0442\u0440\u0430\u043f\u0435\u0446\u043e\u0438\u0434\u0430. \u0414\u043b\u044f \u0435\u0433\u043e \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a (quad). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0438 \u0435\u0433\u043e \u0446\u0432\u0435\u0442\u043e\u0432.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c2f\/bc9\/ce5\/c2fbc9ce504e0e8df61b194f20c83f3b.png\"><\/div>\n<p>  <i>\u0420\u0435\u0431\u0440\u043e \u0442\u0440\u0430\u043f\u0435\u0446\u043e\u0438\u0434\u0430.<\/i><\/p>\n<pre><code class=\"cs\">\tvoid AddQuad (Vector3 v1, Vector3 v2, Vector3 v3, Vector3 v4) { \t\tint vertexIndex = vertices.Count; \t\tvertices.Add(v1); \t\tvertices.Add(v2); \t\tvertices.Add(v3); \t\tvertices.Add(v4); \t\ttriangles.Add(vertexIndex); \t\ttriangles.Add(vertexIndex + 2); \t\ttriangles.Add(vertexIndex + 1); \t\ttriangles.Add(vertexIndex + 1); \t\ttriangles.Add(vertexIndex + 2); \t\ttriangles.Add(vertexIndex + 3); \t}  \tvoid AddQuadColor (Color c1, Color c2, Color c3, Color c4) { \t\tcolors.Add(c1); \t\tcolors.Add(c2); \t\tcolors.Add(c3); \t\tcolors.Add(c4); \t}<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0435\u043c <code>HexMesh.Triangulate<\/code>, \u0447\u0442\u043e\u0431\u044b \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u043b \u043e\u0434\u0438\u043d \u0446\u0432\u0435\u0442, \u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u043f\u043b\u043e\u0448\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c \u0438 \u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u0434\u0432\u0443\u0445 \u0443\u0433\u043b\u043e\u0432.<\/p>\n<pre><code class=\"cs\">\tvoid Triangulate (HexDirection direction, HexCell cell) { \t\tVector3 center = cell.transform.localPosition; \t\tVector3 v1 = center + HexMetrics.GetFirstSolidCorner(direction); \t\tVector3 v2 = center + HexMetrics.GetSecondSolidCorner(direction);  \t\tAddTriangle(center, v1, v2); \t\tAddTriangleColor(cell.color);  \t\tVector3 v3 = center + HexMetrics.GetFirstCorner(direction); \t\tVector3 v4 = center + HexMetrics.GetSecondCorner(direction);  \t\tAddQuad(v1, v2, v3, v4);  \t\tHexCell prevNeighbor = cell.GetNeighbor(direction.Previous()) ?? cell; \t\tHexCell neighbor = cell.GetNeighbor(direction) ?? cell; \t\tHexCell nextNeighbor = cell.GetNeighbor(direction.Next()) ?? cell;  \t\tAddQuadColor( \t\t\tcell.color, \t\t\tcell.color, \t\t\t(cell.color + prevNeighbor.color + neighbor.color) \/ 3f, \t\t\t(cell.color + neighbor.color + nextNeighbor.color) \/ 3f \t\t); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/aea\/8de\/d01\/aea8ded01fc8928ec64293b11b335a91.png\"><\/div>\n<p>  <i>\u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 \u0440\u0451\u0431\u0440\u0430\u043c\u0438 \u0442\u0440\u0430\u043f\u0435\u0446\u043e\u0438\u0434\u043e\u0432.<\/i><\/p>\n<h3>\u041c\u043e\u0441\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0440\u0451\u0431\u0440\u0430\u043c\u0438<\/h3>\n<p>  \u041a\u0430\u0440\u0442\u0438\u043d\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0435\u0449\u0451 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430. \u0421\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0441\u043e\u0441\u0435\u0434\u044f\u043c\u0438 \u0437\u0430\u0433\u0440\u044f\u0437\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u0441 \u0440\u0435\u0431\u0440\u043e\u043c \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u0443\u0433\u043b\u044b \u0438\u0437 \u0442\u0440\u0430\u043f\u0435\u0446\u043e\u0438\u0434\u0430 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043c\u043e\u0441\u0442 \u043c\u0435\u0436\u0434\u0443 \u044f\u0447\u0435\u0439\u043a\u043e\u0439 \u0438 \u0435\u0451 \u0441\u043e\u0441\u0435\u0434\u043e\u043c, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u043f\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u043c \u043f\u0440\u043e\u0431\u0435\u043b\u044b.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b76\/acf\/602\/b76acf602ad32b7001117a17c0e6c72f.png\"><\/div>\n<p>  <i>\u041c\u043e\u0441\u0442 \u043c\u0435\u0436\u0434\u0443 \u0440\u0451\u0431\u0440\u0430\u043c\u0438.<\/i><\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u043d\u043e\u0432\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 <code>v3<\/code> \u0438 <code>v4<\/code>, \u043d\u0430\u0447\u0430\u0432 \u0441 <code>v1<\/code> \u0438 <code>v2<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u0432\u0434\u043e\u043b\u044c \u043c\u043e\u0441\u0442\u0430 \u043f\u0440\u044f\u043c\u043e \u0434\u043e \u0440\u0435\u0431\u0440\u0430 \u044f\u0447\u0435\u0439\u043a\u0438. \u041a\u0430\u043a\u0438\u043c \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0441\u0442\u0430? \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0435\u0433\u043e, \u0432\u0437\u044f\u0432 \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u0442\u043e\u0447\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0443\u0433\u043b\u0430\u043c\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u043a \u043d\u0435\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f. \u042d\u0442\u0438\u043c \u0437\u0430\u0439\u043c\u0451\u0442\u0441\u044f <code>HexMetrics<\/code>.<\/p>\n<pre><code class=\"cs\">\tpublic static Vector3 GetBridge (HexDirection direction) { \t\treturn (corners[(int)direction] + corners[(int)direction + 1]) * \t\t\t0.5f * blendFactor; \t}<\/code><\/pre>\n<p>  \u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a <code>HexMesh<\/code>, \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 <code>AddQuadColor<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0446\u0432\u0435\u0442\u0430.<\/p>\n<pre><code class=\"cs\">\tvoid AddQuadColor (Color c1, Color c2) { \t\tcolors.Add(c1); \t\tcolors.Add(c1); \t\tcolors.Add(c2); \t\tcolors.Add(c2); \t}<\/code><\/pre>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0438\u043c <code>Triangulate<\/code> \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043c\u043e\u0441\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0435\u0434\u044f\u043c\u0438.<\/p>\n<pre><code class=\"cs\">\t\tVector3 bridge = HexMetrics.GetBridge(direction); \t\tVector3 v3 = v1 + bridge; \t\tVector3 v4 = v2 + bridge;  \t\tAddQuad(v1, v2, v3, v4);  \t\tHexCell prevNeighbor = cell.GetNeighbor(direction.Previous()) ?? cell; \t\tHexCell neighbor = cell.GetNeighbor(direction) ?? cell; \t\tHexCell nextNeighbor = cell.GetNeighbor(direction.Next()) ?? cell;  \t\tAddQuadColor(cell.color, (cell.color + neighbor.color) * 0.5f);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/288\/0bd\/fb3\/2880bdfb3ae5b97a5907164fc8b71774.png\"><\/div>\n<p>  <i>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0441\u0442\u044b \u0441 \u0443\u0433\u043b\u043e\u0432\u044b\u043c\u0438 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438.<\/i><\/p>\n<h3>\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u0437\u043e\u0440 \u0432 \u043c\u0435\u0441\u0442\u0430\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0451\u0445 \u044f\u0447\u0435\u0435\u043a. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u044d\u0442\u0438 \u043f\u0440\u043e\u0431\u0435\u043b\u044b, \u0432\u044b\u0440\u0435\u0437\u0430\u0432 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0442\u0440\u0430\u043f\u0435\u0446\u043e\u0438\u0434\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0451\u043c \u044d\u0442\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0441\u043e\u0441\u0435\u0434\u043e\u043c. \u0415\u0433\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u0446\u0432\u0435\u0442 \u044f\u0447\u0435\u0439\u043a\u0438. \u0426\u0432\u0435\u0442\u043e\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0440\u0451\u0445 \u0446\u0432\u0435\u0442\u043e\u0432. \u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0446\u0432\u0435\u0442, \u0447\u0442\u043e \u0438 \u0442\u043e\u0447\u043a\u0430 \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043c\u043e\u0441\u0442\u0430.<\/p>\n<pre><code class=\"cs\">\t\tColor bridgeColor = (cell.color + neighbor.color) * 0.5f; \t\tAddQuadColor(cell.color, bridgeColor);  \t\tAddTriangle(v1, center + HexMetrics.GetFirstCorner(direction), v3); \t\tAddTriangleColor( \t\t\tcell.color, \t\t\t(cell.color + prevNeighbor.color + neighbor.color) \/ 3f, \t\t\tbridgeColor \t\t);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b7f\/d75\/a50\/b7fd75a50368ba2bcb79595fa1c58329.png\"><\/div>\n<p>  <i>\u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e.<\/i><\/p>\n<p>  \u0414\u0440\u0443\u0433\u043e\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u043e\u0441\u0442\u0430 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u0440\u0435\u0442\u044c\u044f, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u0432\u0435\u0440\u0448\u0438\u043d\u0430.<\/p>\n<pre><code class=\"cs\">\t\tAddTriangle(v2, v4, center + HexMetrics.GetSecondCorner(direction)); \t\tAddTriangleColor( \t\t\tcell.color, \t\t\tbridgeColor, \t\t\t(cell.color + neighbor.color + nextNeighbor.color) \/ 3f \t\t);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9a5\/7b2\/d71\/9a57b2d71d5db4aa2c22a2aba954babe.png\"><\/div>\n<p>  <i>\u041f\u043e\u043b\u043d\u0430\u044f \u0440\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0430.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0434\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440. \u0420\u0451\u0431\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u044b\u0442\u044b\u043c\u0438 \u0438\u043b\u0438 \u0440\u0435\u0437\u043a\u0438\u043c\u0438, \u043a\u0430\u043a \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u044f\u0434\u043e\u043c \u0441 \u0433\u0440\u0430\u043d\u0438\u0446\u0435\u0439 \u0441\u0435\u0442\u043a\u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0432\u0435\u0440\u043d\u043e. \u0418 \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u043e \u043d\u0430 \u043f\u043e\u0442\u043e\u043c, \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043f\u043e\u043a\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0435\u043c\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u043c\u0435\u0436\u0434\u0443 \u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\u0422\u0430\u043a\u043e\u0432\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432. \u041e\u043d\u043e \u0438 \u0432 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043b\u043e\u0441\u043a\u0438\u043c\u0438 \u0446\u0432\u0435\u0442\u0430\u043c\u0438. \u0412 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0440\u0435\u043b\u044c\u0435\u0444\u0430 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435.<\/div>\n<\/div>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-2\/blend-regions\/blend-regions.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u0421\u043b\u0438\u044f\u043d\u0438\u0435 \u0440\u0451\u0431\u0435\u0440<\/h2>\n<p>  \u0412\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 \u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u044e \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u043a\u0438. \u041a\u0430\u043a\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043c\u0435\u0442\u043d\u044b? \u0415\u0441\u043b\u0438 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0440\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u0430 \u0444\u043e\u0440\u043c. \u0422\u0443\u0442 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e\u0446\u0432\u0435\u0442\u043d\u044b\u0435 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438, \u0434\u0432\u0443\u0445\u0446\u0432\u0435\u0442\u043d\u044b\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0438 \u0442\u0440\u0451\u0445\u0446\u0432\u0435\u0442\u043d\u044b\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0442\u0440\u0438 \u0446\u0432\u0435\u0442\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0432 \u0442\u043e\u0447\u043a\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0451\u0445 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a27\/370\/ae7\/a27370ae7474595516c3186adb393590.png\"><\/div>\n<p>  <i>\u0422\u0440\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/i><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043a\u0430\u0436\u0434\u044b\u0435 \u0434\u0432\u0430 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u043c \u043c\u043e\u0441\u0442\u043e\u043c. \u0410 \u043a\u0430\u0436\u0434\u044b\u0435 \u0442\u0440\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u043e\u0434\u043d\u0438\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044e. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u044b \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0434\u0432\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e. \u0410 \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0451\u0445 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0448\u0435\u0441\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u042d\u0442\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0444\u0438\u0433\u0443\u0440\u043e\u0439, \u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u043d\u0438\u043a\u0430\u043a\u043e\u0435 \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u0431\u044b \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e, \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 \u0442\u0440\u0443\u0434\u0430\u043c\u0438 \u0438 \u043c\u0435\u043d\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e5d\/448\/ef3\/e5d448ef31208fd42f3e7e73138c3b48.png\"><\/div>\n<p>  <i>\u0421\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c \u043d\u0443\u0436\u043d\u043e.<\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e?<\/b><\/p>\n<div class=\"spoiler_text\">\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0436\u0438\u0437\u043d\u0438 \u0432\u044b \u0447\u0430\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u0451\u0442\u0435 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441. \u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430\u0437\u0430\u0434. \u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430, \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u043e \u044d\u0442\u0430\u043f\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0437\u0430\u0440\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u043e\u0432\u043e\u043c\u0443 \u043f\u043e\u0434\u0445\u043e\u0434\u0443. \u0422\u0430\u043a\u043e\u0435 \u043e\u0437\u0430\u0440\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u0440\u0435\u0448\u0438\u0442\u0435, \u0447\u0442\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443.<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0441\u0442\u0430\u043c\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e<\/h3>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0448\u0438 \u043c\u043e\u0441\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0440\u0451\u0431\u0440\u0430\u043c\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u043b\u0438\u0442\u044c \u0438\u0445 \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0432\u043e\u0438\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u043c\u043e\u0441\u0442\u0430. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0440\u0435\u0434\u043d\u044f\u0442\u044c \u0434\u0432\u0430 \u0443\u0433\u043b\u0430 <code>HexMetrics.GetBridge<\/code>. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445, \u0430 \u0437\u0430\u0442\u0435\u043c \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cs\">\tpublic static Vector3 GetBridge (HexDirection direction) { \t\treturn (corners[(int)direction] + corners[(int)direction + 1]) * \t\t\tblendFactor; \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f16\/8d6\/33f\/f168d633fff07b5ecd6bf361e14e0edd.png\"><\/div>\n<p>  <i>\u041c\u043e\u0441\u0442\u044b \u0440\u0430\u0441\u0442\u044f\u043d\u0443\u043b\u0438\u0441\u044c \u043d\u0430 \u0432\u0441\u044e \u0434\u043b\u0438\u043d\u0443 \u0438 \u043d\u0430\u043b\u043e\u0436\u0438\u043b\u0438\u0441\u044c \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0441\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043f\u0440\u044f\u043c\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438. \u041d\u043e \u043c\u044b \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u043e \u0434\u0432\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043d\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043e\u0441\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043c \u043d\u0430\u0448 \u043a\u043e\u0434 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438. \u0423\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0451, \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0440\u0451\u0431\u0435\u0440 \u0438 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432. \u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043c\u043e\u0441\u0442\u0430. \u041f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0438\u0445 \u0437\u0430\u043d\u043e\u0432\u043e.<\/p>\n<pre><code class=\"cs\">\tvoid Triangulate (HexDirection direction, HexCell cell) { \t\tVector3 center = cell.transform.localPosition; \t\tVector3 v1 = center + HexMetrics.GetFirstSolidCorner(direction); \t\tVector3 v2 = center + HexMetrics.GetSecondSolidCorner(direction);  \t\tAddTriangle(center, v1, v2); \t\tAddTriangleColor(cell.color);  \t\tTriangulateConnection(direction, cell, v1, v2); \t}  \tvoid TriangulateConnection ( \t\tHexDirection direction, HexCell cell, Vector3 v1, Vector3 v2 \t) { \t\tHexCell neighbor = cell.GetNeighbor(direction) ?? cell; \t\t \t\tVector3 bridge = HexMetrics.GetBridge(direction); \t\tVector3 v3 = v1 + bridge; \t\tVector3 v4 = v2 + bridge;  \t\tAddQuad(v1, v2, v3, v4); \t\tAddQuadColor(cell.color, neighbor.color); \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043e\u0436\u0435\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u043e\u0441\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c NE.<\/p>\n<pre><code class=\"cs\">\t\tif (direction == HexDirection.NE) { \t\t\tTriangulateConnection(direction, cell, v1, v2); \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cfa\/7ac\/53f\/cfa7ac53f3fbab322c4c481f29ec1cac.png\"><\/div>\n<p>  <i>\u041c\u043e\u0441\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 NE.<\/i><\/p>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u044f \u0438\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0435\u0440\u0432\u044b\u0445 \u0442\u0440\u0451\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445: NE, E \u0438 SE.<\/p>\n<pre><code class=\"cs\">\t\tif (direction &lt;= HexDirection.SE) { \t\t\tTriangulateConnection(direction, cell, v1, v2); \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/568\/698\/e07\/568698e079839a5ff4108083c6f71d8d.png\"><\/div>\n<p>  <i>\u0412\u0441\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043c\u043e\u0441\u0442\u044b \u0438 \u043c\u043e\u0441\u0442\u044b \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u0445.<\/i><\/p>\n<p>  \u041c\u044b \u043f\u043e\u043a\u0440\u044b\u043b\u0438 \u0432\u0441\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438. \u041d\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0441\u0442\u043e\u0432, \u0432\u0435\u0434\u0443\u0449\u0438\u0445 \u0438\u0437 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 \u043d\u0438\u043a\u0443\u0434\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0437\u0431\u0430\u0432\u0438\u043c\u0441\u044f \u043e\u0442 \u043d\u0438\u0445, \u0432\u044b\u0445\u043e\u0434\u044f \u0438\u0437 <code>TriangulateConnection<\/code>, \u043a\u043e\u0433\u0434\u0430 \u0441\u043e\u0441\u0435\u0434\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442. \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0441\u0430\u043c\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u043e\u0439.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateConnection ( \t\tHexDirection direction, HexCell cell, Vector3 v1, Vector3 v2 \t) { \t\tHexCell neighbor = cell.GetNeighbor(direction); \t\tif (neighbor == null) { \t\t\treturn; \t\t} \t\t \t\t\u2026 \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5a2\/54c\/21d\/5a254c21d71cf66817a1ee42b7f02ddd.png\"><\/div>\n<p>  <i>\u0422\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043c\u043e\u0441\u0442\u044b.<\/i><\/p>\n<h3>\u0422\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u0441\u043d\u043e\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0434\u043b\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0441\u0435\u0434\u043e\u043c. \u0418 \u044d\u0442\u043e \u0441\u043d\u043e\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0441\u043e\u0441\u0435\u0434 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateConnection ( \t\tHexDirection direction, HexCell cell, Vector3 v1, Vector3 v2 \t) { \t\t\u2026  \t\tHexCell nextNeighbor = cell.GetNeighbor(direction.Next()); \t\tif (nextNeighbor != null) { \t\t\tAddTriangle(v2, v4, v2); \t\t\tAddTriangleColor(cell.color, neighbor.color, nextNeighbor.color); \t\t} \t}<\/code><\/pre>\n<p>  \u041a\u0430\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b? \u042f \u0432\u0441\u0442\u0430\u0432\u0438\u043b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043c\u0435\u043d\u044b <code>v2<\/code>, \u043d\u043e \u044d\u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e. \u0422\u0430\u043a \u043a\u0430\u043a \u043a\u0430\u0436\u0434\u043e\u0435 \u0440\u0435\u0431\u0440\u043e \u044d\u0442\u0438\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u043c\u043e\u0441\u0442\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0435\u0451, \u043f\u0440\u043e\u0439\u0434\u044f \u043f\u043e \u043c\u043e\u0441\u0442\u0443 \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0430.<\/p>\n<pre><code class=\"cs\">\t\t\tAddTriangle(v2, v4, v2 + HexMetrics.GetBridge(direction.Next()));<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b5c\/256\/bde\/b5c256bde3a05d41287ca96007e208f4.png\"><\/div>\n<p>  <i>\u041c\u044b \u0441\u043d\u043e\u0432\u0430 \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u0443\u044e \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044e.<\/i><\/p>\n<p>  \u041c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438? \u041f\u043e\u043a\u0430 \u043d\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0442\u0440\u0438 \u044f\u0447\u0435\u0439\u043a\u0438 \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u043d\u043e \u043e\u0431\u0449\u0435\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0439\u0434\u0443\u0442 NE \u0438 E.<\/p>\n<pre><code class=\"cs\">\t\tif (direction &lt;= HexDirection.E &amp;&amp; nextNeighbor != null) { \t\t\tAddTriangle(v2, v4, v2 + HexMetrics.GetBridge(direction.Next())); \t\t\tAddTriangleColor(cell.color, neighbor.color, nextNeighbor.color); \t\t}<\/code><\/pre>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-2\/fusing-edges\/fusing-edges.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c 3: \u0432\u044b\u0441\u043e\u0442\u044b<\/h1>\n<p>  <\/p>\n<h2>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044f\u0447\u0435\u0439\u043a\u0430\u043c \u0432\u044b\u0441\u043e\u0442\u0443.<\/li>\n<li>\u0422\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0441\u043a\u043b\u043e\u043d\u044b.<\/li>\n<li>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0443\u0441\u0442\u0443\u043f\u044b.<\/li>\n<li>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0443\u0441\u0442\u0443\u043f\u044b \u0438 \u043e\u0431\u0440\u044b\u0432\u044b.<\/li>\n<\/ul>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0432\u044b\u0441\u043e\u0442\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8da\/24a\/e1f\/8da24ae1f70e4770264ed0ab05d183ef.png\"><\/div>\n<p>  <i>\u0412\u044b\u0441\u043e\u0442\u044b \u0438 \u0443\u0441\u0442\u0443\u043f\u044b.<\/i><\/p>\n<h2>\u0412\u044b\u0441\u043e\u0442\u0430 \u044f\u0447\u0435\u0435\u043a<\/h2>\n<p>  \u041c\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b\u0438 \u043d\u0430\u0448\u0443 \u043a\u0430\u0440\u0442\u0443 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u044f\u0447\u0435\u0439\u043a\u0438, \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043f\u043b\u043e\u0441\u043a\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043f\u0440\u0438\u0434\u0430\u0434\u0438\u043c \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u0442\u044b. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0443\u0440\u043e\u0432\u043d\u0438 \u0432\u044b\u0441\u043e\u0442, \u0447\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0445 \u043a\u0430\u043a \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 <code>HexCell<\/code>.<\/p>\n<pre><code class=\"cs\">\tpublic int elevation;<\/code><\/pre>\n<p>  \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u0442\u044b? \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0435\u0433\u043e \u043a\u0430\u043a \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 <code>HexMetrics<\/code>. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0433 \u0432 \u043f\u044f\u0442\u044c \u0435\u0434\u0438\u043d\u0438\u0446, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u0431\u044b\u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u044b. \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0438\u0433\u0440\u0435 \u044f \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0448\u0430\u0433 \u043f\u043e\u043c\u0435\u043d\u044c\u0448\u0435.<\/p>\n<pre><code class=\"cs\">\tpublic const float elevationStep = 5f;<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044f\u0447\u0435\u0435\u043a<\/h3>\n<p>  \u0414\u043e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0446\u0432\u0435\u0442 \u044f\u0447\u0435\u0439\u043a\u0438, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u0438 \u0435\u0451 \u0432\u044b\u0441\u043e\u0442\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0430 <code>HexGrid.ColorCell<\/code> \u043d\u0430\u043c \u0443\u0436\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u043f\u0446\u0438\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0447\u0435\u0435\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c <code>ColorCell<\/code> \u0432 <code>GetCell<\/code> \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u044f\u0447\u0435\u0439\u043a\u0443 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438.<\/p>\n<pre><code class=\"cs\">\tpublic HexCell GetCell (Vector3 position) { \t\tposition = transform.InverseTransformPoint(position); \t\tHexCoordinates coordinates = HexCoordinates.FromPosition(position); \t\tint index = coordinates.X + coordinates.Z * width + coordinates.Z \/ 2; \t\treturn cells[index]; \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u044f\u0447\u0435\u0439\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0442\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u043e\u0432\u0430 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 <code>HexGrid.Refresh<\/code>.<\/p>\n<pre><code class=\"cs\">\tpublic void Refresh () { \t\thexMesh.Triangulate(cells); \t}<\/code><\/pre>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0438\u043c <code>HexMapEditor<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438. \u0414\u0430\u0434\u0438\u043c \u0435\u043c\u0443 \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>EditCell<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0439\u043c\u0451\u0442\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u044f\u0447\u0435\u0439\u043a\u0438, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0435\u0442\u043a\u0443.<\/p>\n<pre><code class=\"cs\">\tvoid HandleInput () { \t\tRay inputRay = Camera.main.ScreenPointToRay(Input.mousePosition); \t\tRaycastHit hit; \t\tif (Physics.Raycast(inputRay, out hit)) { \t\t\tEditCell(hexGrid.GetCell(hit.point)); \t\t} \t}  \tvoid EditCell (HexCell cell) { \t\tcell.color = activeColor; \t\thexGrid.Refresh(); \t}<\/code><\/pre>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u044b, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u043d\u0443\u0436\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u0442\u044b.<\/p>\n<pre><code class=\"cs\">\tint activeElevation;  \tvoid EditCell (HexCell cell) { \t\tcell.color = activeColor; \t\tcell.elevation = activeElevation; \t\thexGrid.Refresh(); \t}<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0446\u0432\u0435\u0442\u0430\u043c\u0438, \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432\u044b\u0441\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u0432\u044f\u0436\u0435\u043c \u0441 UI. \u0414\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 \u0432\u044b\u0441\u043e\u0442 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u043e\u043b\u0437\u0443\u043d\u043a\u043e\u043c. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u0437\u0443\u043d\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 float, \u043d\u0430\u0448\u0435\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 float. \u041c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 integer.<\/p>\n<pre><code class=\"cs\">\tpublic void SetElevation (float elevation) { \t\tactiveElevation = (int)elevation; \t}<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430 canvas \u043f\u043e\u043b\u0437\u0443\u043d\u043e\u043a (<i>GameObject \/ Create \/ Slider<\/i>) \u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u043f\u043e\u0434 \u043f\u0430\u043d\u0435\u043b\u044c\u044e \u0446\u0432\u0435\u0442\u043e\u0432. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c, \u0441\u043d\u0438\u0437\u0443 \u0432\u0432\u0435\u0440\u0445, \u0447\u0442\u043e\u0431\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0443\u0440\u043e\u0432\u043d\u044f\u043c \u0432\u044b\u0441\u043e\u0442. \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u0435\u0433\u043e \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442 0 \u0434\u043e 6. \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u043c \u0435\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <i>On Value Changed<\/i> \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <code>SetElevation<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <i>Hex Map Editor<\/i>. \u041c\u0435\u0442\u043e\u0434 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0441\u044f \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u0437\u0443\u043d\u043a\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/05f\/6c5\/93c\/05f6c593cc553c4f4a86f9c2e9012156.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7c6\/0a5\/e8b\/7c60a5e8bfebd2ec87d2daaeeb148be6.png\"><\/div>\n<p>  <i>\u041f\u043e\u043b\u0437\u0443\u043d\u043e\u043a \u0432\u044b\u0441\u043e\u0442\u044b.<\/i><\/p>\n<h3>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u0441\u043e\u0442\u044b<\/h3>\n<p>  \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u044f\u0447\u0435\u0439\u043a\u0438 \u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0434\u0430\u0451\u043c \u0438 \u0446\u0432\u0435\u0442, \u0438 \u0432\u044b\u0441\u043e\u0442\u0443. \u0425\u043e\u0442\u044f \u0432 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0432\u044b\u0441\u043e\u0442\u0430 \u0438 \u0432 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0435\u0451 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442.<\/p>\n<p>  \u041d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0432\u044b\u0441\u043e\u0442\u044b. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <code>HexCell.elevation<\/code> \u0447\u0430\u0441\u0442\u043d\u044b\u043c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>HexCell.Elevation<\/code>.<\/p>\n<pre><code class=\"cs\">\tpublic int Elevation { \t\tget { \t\t\treturn elevation; \t\t} \t\tset { \t\t\televation = value; \t\t} \t} \t \tint elevation;<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u0440\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u044b\u0441\u043e\u0442\u044b.<\/p>\n<pre><code class=\"cs\">\t\tset { \t\t\televation = value; \t\t\tVector3 position = transform.localPosition; \t\t\tposition.y = value * HexMetrics.elevationStep; \t\t\ttransform.localPosition = position; \t\t}<\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 <code>HexMapEditor.EditCell<\/code>.<\/p>\n<pre><code class=\"cs\">\tvoid EditCell (HexCell cell) { \t\tcell.color = activeColor; \t\tcell.Elevation = activeElevation; \t\thexGrid.Refresh(); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/652\/5de\/6eb\/6525de6ebae59208507af3e8b744bab5.png\"><\/div>\n<p>  <i>\u042f\u0447\u0435\u0439\u043a\u0438 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0432\u044b\u0441\u043e\u0442\u0430\u043c\u0438.<\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043b\u0438 mesh collider, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0434 \u043d\u043e\u0432\u0443\u044e \u0432\u044b\u0441\u043e\u0442\u0443?<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Unity \u0434\u043b\u044f \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e \u0436\u0435 \u043c\u0435\u0448\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0434\u043b\u044f mesh collider \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 null. \u0414\u0432\u0438\u0436\u043e\u043a \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u043b, \u0447\u0442\u043e \u043c\u0435\u0448\u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0435\u0448 \u0438\u043b\u0438 null \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u0438 \u043a \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u043a\u043e\u043b\u043b\u0430\u0439\u0434\u0435\u0440\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 (\u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0448\u0430 \u043a\u043e\u043b\u043b\u0430\u0439\u0434\u0435\u0440\u0443 \u043f\u043e\u0441\u043b\u0435 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438) \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0441\u043e\u0442\u044b \u044f\u0447\u0435\u0435\u043a \u0432\u0438\u0434\u043d\u044b, \u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0434\u0432\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445. \u043c\u0435\u0442\u043a\u0438 \u044f\u0447\u0435\u0435\u043a \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u043f\u043e\u0434 \u043f\u043e\u0434\u043d\u044f\u0442\u044b\u043c\u0438 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442 \u0432\u044b\u0441\u043e\u0442\u0443. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c.<\/p>\n<h3>\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u043a \u044f\u0447\u0435\u0435\u043a<\/h3>\n<p>  \u041d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u0435\u0442\u043a\u0438 UI \u0434\u043b\u044f \u044f\u0447\u0435\u0435\u043a \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u044b \u043e \u043d\u0438\u0445 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c. \u0414\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0445 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0445 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u0430\u0434\u0438\u043c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 <code>HexCell<\/code> \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <code>RectTransform<\/code> \u0435\u0433\u043e \u043c\u0435\u0442\u043a\u0438 UI, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u0437\u0436\u0435 \u0435\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c.<\/p>\n<pre><code class=\"cs\">\tpublic RectTransform uiRect;<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0441\u0432\u043e\u0438\u043c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0446\u0435 <code>HexGrid.CreateCell<\/code>.<\/p>\n<pre><code class=\"cs\">\tvoid CreateCell (int x, int z, int i) { \t\t\u2026 \t\tcell.uiRect = label.rectTransform; \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>HexCell.Elevation<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044e UI \u044f\u0447\u0435\u0439\u043a\u0438. \u0422\u0430\u043a \u043a\u0430\u043a canvas \u0441\u0435\u0442\u043a\u0438 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u043f\u043e\u0432\u0451\u0440\u043d\u0443\u0442, \u0442\u043e \u043c\u0435\u0442\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u0432 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043f\u043e \u043e\u0441\u0438 Z, \u0430 \u043d\u0435 \u0432 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0441\u0438 Y.<\/p>\n<pre><code class=\"cs\">\t\tset { \t\t\televation = value; \t\t\tVector3 position = transform.localPosition; \t\t\tposition.y = value * HexMetrics.elevationStep; \t\t\ttransform.localPosition = position;  \t\t\tVector3 uiPosition = uiRect.localPosition; \t\t\tuiPosition.z = elevation * -HexMetrics.elevationStep; \t\t\tuiRect.localPosition = uiPosition; \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c72\/b81\/c97\/c72b81c970b2bddfe2b2ce6d22471dc0.png\"><\/div>\n<p>  <i>\u041c\u0435\u0442\u043a\u0438 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0432\u044b\u0441\u043e\u0442\u044b.<\/i><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u043b\u043e\u043d\u043e\u0432<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043b\u043e\u0441\u043a\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u044f\u0447\u0435\u0435\u043a \u0432 \u0441\u043a\u043b\u043e\u043d\u044b. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432 <code>HexMesh.TriangulateConnection<\/code>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0440\u0451\u0431\u0435\u0440 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u043e\u043d\u0446\u0430 \u043c\u043e\u0441\u0442\u0430.<\/p>\n<pre><code class=\"cs\">\t\tVector3 bridge = HexMetrics.GetBridge(direction); \t\tVector3 v3 = v1 + bridge; \t\tVector3 v4 = v2 + bridge; \t\tv3.y = v4.y = neighbor.Elevation * HexMetrics.elevationStep;<\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0433\u043b\u043e\u0432\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441 \u043c\u043e\u0441\u0442\u043e\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0441\u043e\u0441\u0435\u0434\u0443.<\/p>\n<pre><code class=\"cs\">\t\tif (direction &lt;= HexDirection.E &amp;&amp; nextNeighbor != null) { \t\t\tVector3 v5 = v2 + HexMetrics.GetBridge(direction.Next()); \t\t\tv5.y = nextNeighbor.Elevation * HexMetrics.elevationStep; \t\t\tAddTriangle(v2, v4, v5); \t\t\tAddTriangleColor(cell.color, neighbor.color, nextNeighbor.color); \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/49b\/548\/792\/49b5487921c6844b7a282e049a97bbd9.png\"><\/div>\n<p>  <i>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0432\u044b\u0441\u043e\u0442\u044b.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u044f\u0447\u0435\u0435\u043a \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u044b\u0441\u043e\u0442\u0430\u0445 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u043d\u0430\u043a\u043b\u043e\u043d\u043d\u044b\u043c\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u0438 \u0441\u043a\u043b\u043e\u043d\u044b \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438.<\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-3\/cell-elevation\/cell-elevation.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0440\u0451\u0431\u0435\u0440 \u0441 \u0443\u0441\u0442\u0443\u043f\u0430\u043c\u0438<\/h2>\n<p>  \u041f\u0440\u044f\u043c\u044b\u0435 \u0441\u043a\u043b\u043e\u043d\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0443\u0441\u0442\u0443\u043f\u044b. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0438\u0433\u0440\u0435 Endless Legend.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043a\u043b\u043e\u043d \u043f\u043e \u0434\u0432\u0430 \u0443\u0441\u0442\u0443\u043f\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u043b\u043e\u043d \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0440\u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445, \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u043f\u043b\u043e\u0441\u043a\u0438\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u0427\u0442\u043e\u0431\u044b \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432 \u043f\u044f\u0442\u044c \u044d\u0442\u0430\u043f\u043e\u0432.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ce3\/08b\/82d\/ce308b82db1bb0c72c387cc9da480d54.png\"><\/div>\n<p>  <i>\u0414\u0432\u0430 \u0443\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0441\u043a\u043b\u043e\u043d\u0435.<\/i><\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0441\u0442\u0443\u043f\u043e\u0432 \u0434\u043b\u044f \u0441\u043a\u043b\u043e\u043d\u0430 \u0432 <code>HexMetrics<\/code> \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u0430\u043f\u043e\u0432.<\/p>\n<pre><code class=\"cs\">\tpublic const int terracesPerSlope = 2;  \tpublic const int terraceSteps = terracesPerSlope * 2 + 1;<\/code><\/pre>\n<p>  \u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u0432\u0434\u043e\u043b\u044c \u0441\u043a\u043b\u043e\u043d\u0430. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 Y \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u0435\u0447\u0451\u0442\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u0430\u0445. \u0418\u043d\u0430\u0447\u0435 \u043c\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043b\u043e\u0441\u043a\u0438\u0445 \u0443\u0441\u0442\u0443\u043f\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 <code>HexMetrics<\/code>.<\/p>\n<pre><code class=\"cs\">\tpublic static Vector3 TerraceLerp (Vector3 a, Vector3 b, int step) { \t\treturn a; \t}<\/code><\/pre>\n<p>  \u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0430\u0433\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438.<\/p>\n<pre><code class=\"cs\">\tpublic const float horizontalTerraceStepSize = 1f \/ terraceSteps; \t \tpublic static Vector3 TerraceLerp (Vector3 a, Vector3 b, int step) { \t\tfloat h = step * HexMetrics.horizontalTerraceStepSize; \t\ta.x += (b.x - a.x) * h; \t\ta.z += (b.z - a.z) * h; \t\treturn a; \t}<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438?<\/b><\/p>\n<div class=\"spoiler_text\">\u0418\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/302\/c72\/04e\/302c7204ea9987e698a70307646abd71.svg\" alt=\"$b$\" data-tex=\"inline\"><\/math> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0442\u043e\u0440\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9b0\/012\/4e4\/9b00124e411362185d05b841bc32695f.svg\" alt=\"$t$\" data-tex=\"inline\"><\/math>. \u041a\u043e\u0433\u0434\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9b0\/012\/4e4\/9b00124e411362185d05b841bc32695f.svg\" alt=\"$t$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u0435\u043d 0, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0432\u0435\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math>. \u041a\u043e\u0433\u0434\u0430 \u043e\u043d \u0440\u0430\u0432\u0435\u043d 1, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0432\u0435\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/302\/c72\/04e\/302c7204ea9987e698a70307646abd71.svg\" alt=\"$b$\" data-tex=\"inline\"><\/math>. \u041a\u043e\u0433\u0434\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9b0\/012\/4e4\/9b00124e411362185d05b841bc32695f.svg\" alt=\"$t$\" data-tex=\"inline\"><\/math> \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0434\u0435-\u0442\u043e \u043c\u0435\u0436\u0434\u0443 0 \u0438 1, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/302\/c72\/04e\/302c7204ea9987e698a70307646abd71.svg\" alt=\"$b$\" data-tex=\"inline\"><\/math> \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u044e\u0442\u0441\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d52\/4b4\/bad\/d524b4bad4c25285b3a9c356a893aae1.svg\" alt=\"$(1 - t)a + tb$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c37\/6f9\/e44\/c376f9e44fa746eefeec8f3fb942c693.svg\" alt=\"$(1 - t)a + tb = a - ta + tb = a + t(b - a)$\" data-tex=\"inline\"><\/math>. \u0422\u0440\u0435\u0442\u044c\u044f \u0444\u043e\u0440\u043c\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u043a\u0430\u043a \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math> \u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/302\/c72\/04e\/302c7204ea9987e698a70307646abd71.svg\" alt=\"$b$\" data-tex=\"inline\"><\/math> \u043f\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/776\/33b\/e07\/77633be075fbb32a6528f26c7d241212.svg\" alt=\"$(b - a)$\" data-tex=\"inline\"><\/math>. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0434\u043b\u044f \u0435\u0451 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044c\u0448\u0435.<\/div>\n<\/div>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c Y \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u0435\u0447\u0451\u0442\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u0430\u0445, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cfb\/eb3\/be4\/cfbeb3be4aeaf36da6ce65180835d2e7.svg\" alt=\"$(step + 1) \/ 2$\" data-tex=\"inline\"><\/math>. \u0415\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0442\u043e \u043e\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442 \u0440\u044f\u0434 1, 2, 3, 4 \u0432 1, 1, 2, 2.<\/p>\n<pre><code class=\"cs\">\tpublic const float verticalTerraceStepSize = 1f \/ (terracesPerSlope + 1); \t \tpublic static Vector3 TerraceLerp (Vector3 a, Vector3 b, int step) { \t\tfloat h = step * HexMetrics.horizontalTerraceStepSize; \t\ta.x += (b.x - a.x) * h; \t\ta.z += (b.z - a.z) * h; \t\tfloat v = ((step + 1) \/ 2) * HexMetrics.verticalTerraceStepSize; \t\ta.y += (b.y - a.y) * v; \t\treturn a; \t}<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u0443\u0441\u0442\u0443\u043f\u043e\u0432 \u0438 \u0434\u043b\u044f \u0446\u0432\u0435\u0442\u043e\u0432. \u041f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u0442\u0430\u043a, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043f\u043b\u043e\u0441\u043a\u0438\u0435.<\/p>\n<pre><code class=\"cs\">\tpublic static Color TerraceLerp (Color a, Color b, int step) { \t\tfloat h = step * HexMetrics.horizontalTerraceStepSize; \t\treturn Color.Lerp(a, b, h); \t}<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0422\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044f<\/h3>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0440\u0451\u0431\u0435\u0440 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0443\u0431\u0435\u0440\u0451\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0438\u0437 <code>HexMesh.TriangulateConnection<\/code> \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044e \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0435\u0433\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateConnection ( \t\tHexDirection direction, HexCell cell, Vector3 v1, Vector3 v2 \t) { \t\t\u2026 \t\tVector3 bridge = HexMetrics.GetBridge(direction); \t\tVector3 v3 = v1 + bridge; \t\tVector3 v4 = v2 + bridge; \t\tv3.y = v4.y = neighbor.Elevation * HexMetrics.elevationStep;  \t\tTriangulateEdgeTerraces(v1, v2, cell, v3, v4, neighbor); \/\/\t\tAddQuad(v1, v2, v3, v4); \/\/\t\tAddQuadColor(cell.color, neighbor.color); \t\t\u2026 \t}  \tvoid TriangulateEdgeTerraces ( \t\tVector3 beginLeft, Vector3 beginRight, HexCell beginCell, \t\tVector3 endLeft, Vector3 endRight, HexCell endCell \t) { \t\tAddQuad(beginLeft, beginRight, endLeft, endRight); \t\tAddQuadColor(beginCell.color, endCell.color); \t}<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043d\u0430\u0448\u0438\u043c\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e quad. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0437\u0434\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0441\u043a\u043b\u043e\u043d, \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0443\u0442\u043e\u0439, \u0447\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateEdgeTerraces ( \t\tVector3 beginLeft, Vector3 beginRight, HexCell beginCell, \t\tVector3 endLeft, Vector3 endRight, HexCell endCell \t) { \t\tVector3 v3 = HexMetrics.TerraceLerp(beginLeft, endLeft, 1); \t\tVector3 v4 = HexMetrics.TerraceLerp(beginRight, endRight, 1); \t\tColor c2 = HexMetrics.TerraceLerp(beginCell.color, endCell.color, 1);  \t\tAddQuad(beginLeft, beginRight, v3, v4); \t\tAddQuadColor(beginCell.color, c2); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/434\/174\/aea\/434174aea469a4ba7da285ff02d4467a.png\"><\/div>\n<p>  <i>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0443\u0441\u0442\u0443\u043f\u0430.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u044d\u0442\u0430\u043f\u0443, \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0432 \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u042d\u0442\u0438\u043c \u043c\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0440\u0451\u0431\u0435\u0440, \u0445\u043e\u0442\u044f \u043f\u043e\u043a\u0430 \u0438 \u0441 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u043e\u0439.<\/p>\n<pre><code class=\"cs\">\t\tAddQuad(beginLeft, beginRight, v3, v4); \t\tAddQuadColor(beginCell.color, c2);  \t\tAddQuad(v3, v4, endLeft, endRight); \t\tAddQuadColor(c2, endCell.color);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c6f\/1be\/b3e\/c6f1beb3ee6663cf8984130dc3d9378e.png\"><\/div>\n<p>  <i>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0443\u0441\u0442\u0443\u043f\u0430.<\/i><\/p>\n<p>  \u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u044d\u0442\u0430\u043f\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0446\u0438\u043a\u043b. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0434\u0432\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u043c\u0438 \u043f\u0435\u0440\u0432\u044b\u043c\u0438. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0438 \u043a \u0446\u0432\u0435\u0442\u0443. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u0446\u0432\u0435\u0442\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0451 \u043e\u0434\u0438\u043d quad.<\/p>\n<pre><code class=\"cs\">\t\tAddQuad(beginLeft, beginRight, v3, v4); \t\tAddQuadColor(beginCell.color, c2);  \t\tfor (int i = 2; i &lt; HexMetrics.terraceSteps; i++) { \t\t\tVector3 v1 = v3; \t\t\tVector3 v2 = v4; \t\t\tColor c1 = c2; \t\t\tv3 = HexMetrics.TerraceLerp(beginLeft, endLeft, i); \t\t\tv4 = HexMetrics.TerraceLerp(beginRight, endRight, i); \t\t\tc2 = HexMetrics.TerraceLerp(beginCell.color, endCell.color, i); \t\t\tAddQuad(v1, v2, v3, v4); \t\t\tAddQuadColor(c1, c2); \t\t}  \t\tAddQuad(v3, v4, endLeft, endRight); \t\tAddQuadColor(c2, endCell.color);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e6d\/20f\/64c\/e6d20f64c28feaa5329f085d8a5b673a.png\"><\/div>\n<p>  <i>\u0412\u0441\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u044d\u0442\u0430\u043f\u044b.<\/i><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u0432\u0441\u0435\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0440\u0451\u0431\u0435\u0440 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0443\u0441\u0442\u0443\u043f\u0430, \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u0432 <code>HexMetrics.terracesPerSlope<\/code>. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u043c\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0443\u0441\u0442\u0443\u043f\u043e\u0432 \u0434\u043b\u044f \u0443\u0433\u043b\u043e\u0432\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439, \u043c\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u043e \u043d\u0430 \u043f\u043e\u0442\u043e\u043c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4f3\/37b\/4f9\/4f337b4f9ba0092144e1148b10a4970b.png\"><\/div>\n<p>  <i>\u0412\u0441\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0440\u0451\u0431\u0435\u0440 \u0438\u043c\u0435\u044e\u0442 \u0443\u0441\u0442\u0443\u043f\u044b.<\/i><\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-3\/terraced-edge-connections\/terraced-edge-connections.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u0422\u0438\u043f\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439<\/h2>\n<p>  \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0440\u0451\u0431\u0435\u0440 \u0432 \u0443\u0441\u0442\u0443\u043f\u044b \u2014 \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0443\u0436 \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u0434\u0435\u044f. \u041e\u043d\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432\u044b\u0441\u043e\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c. \u041d\u043e \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0443\u0437\u043a\u0438\u0435 \u0443\u0441\u0442\u0443\u043f\u044b \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438, \u0430 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u043e. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0443\u043f\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u044d\u0442\u043e \u0438 \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0442\u0440\u0438 \u0442\u0438\u043f\u0430 \u0440\u0451\u0431\u0435\u0440: \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u0441\u043a\u043b\u043e\u043d \u0438 \u043e\u0431\u0440\u044b\u0432. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"cs\">public enum HexEdgeType { \tFlat, Slope, Cliff }<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0441 \u043a\u0430\u043a\u0438\u043c \u0442\u0438\u043f\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e? \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 <code>HexMetrics<\/code> \u043c\u0435\u0442\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0434\u0432\u0430 \u0443\u0440\u043e\u0432\u043d\u044f \u0432\u044b\u0441\u043e\u0442\u044b.<\/p>\n<pre><code class=\"cs\">\tpublic static HexEdgeType GetEdgeType (int elevation1, int elevation2) { \t}<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b\u0441\u043e\u0442\u044b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u043b\u043e\u0441\u043a\u043e\u0435 \u0440\u0435\u0431\u0440\u043e.<\/p>\n<pre><code class=\"cs\">\tpublic static HexEdgeType GetEdgeType (int elevation1, int elevation2) { \t\tif (elevation1 == elevation2) { \t\t\treturn HexEdgeType.Flat; \t\t} \t}<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0440\u0430\u0432\u043d\u0430 \u043e\u0434\u043d\u043e\u043c\u0443 \u0448\u0430\u0433\u0443, \u0442\u043e \u044d\u0442\u043e \u0441\u043a\u043b\u043e\u043d. \u041d\u0435\u0432\u0430\u0436\u043d\u043e, \u0438\u0434\u0451\u0442 \u043b\u0438 \u043e\u043d \u0432\u0432\u0435\u0440\u0445 \u0438\u043b\u0438 \u0432\u043d\u0438\u0437. \u0412\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u044b\u0432.<\/p>\n<pre><code class=\"cs\">\tpublic static HexEdgeType GetEdgeType (int elevation1, int elevation2) { \t\tif (elevation1 == elevation2) { \t\t\treturn HexEdgeType.Flat; \t\t} \t\tint delta = elevation2 - elevation1; \t\tif (delta == 1 || delta == -1) { \t\t\treturn HexEdgeType.Slope; \t\t} \t\treturn HexEdgeType.Cliff; \t}<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>HexCell.GetEdgeType<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u0440\u0435\u0431\u0440\u0430 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<pre><code class=\"cs\">\tpublic HexEdgeType GetEdgeType (HexDirection direction) { \t\treturn HexMetrics.GetEdgeType( \t\t\televation, neighbors[(int)direction].elevation \t\t); \t}<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0430\u0437\u0432\u0435 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u043e\u0441\u0435\u0434?<\/b><\/p>\n<div class=\"spoiler_text\">\u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0442\u0438\u043f \u0440\u0435\u0431\u0440\u0430 \u0432 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \u043a\u0430\u0440\u0442\u044b. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e\u0441\u0435\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c <code>NullReferenceException<\/code>. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u044d\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u0438 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0440\u043e\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u041d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u044f\u0432\u043d\u043e. \u0415\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u0430 \u0441 \u0440\u0435\u0431\u0440\u043e\u043c \u0433\u0440\u0430\u043d\u0438\u0446\u044b. \u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043c \u0433\u0434\u0435-\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c <code>NullReferenceException<\/code>.<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0443\u0441\u0442\u0443\u043f\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u043a\u043b\u043e\u043d\u043e\u0432<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0443\u0441\u0442\u0443\u043f\u044b. \u0418\u0437\u043c\u0435\u043d\u0438\u043c <code>HexMesh.TriangulateConnection<\/code> \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u0443\u0441\u0442\u0443\u043f\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u043a\u043b\u043e\u043d\u043e\u0432.<\/p>\n<pre><code class=\"cs\">\t\tif (cell.GetEdgeType(direction) == HexEdgeType.Slope) { \t\t\tTriangulateEdgeTerraces(v1, v2, cell, v3, v4, neighbor); \t\t} \/\/\t\tAddQuad(v1, v2, v3, v4); \/\/\t\tAddQuadColor(cell.color, neighbor.color);<\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0437\u0430\u043d\u044f\u043b\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439 \u0438 \u043e\u0431\u0440\u044b\u0432\u043e\u0432.<\/p>\n<pre><code class=\"cs\">\t\tif (cell.GetEdgeType(direction) == HexEdgeType.Slope) { \t\t\tTriangulateEdgeTerraces(v1, v2, cell, v3, v4, neighbor); \t\t} \t\telse { \t\t\tAddQuad(v1, v2, v3, v4); \t\t\tAddQuadColor(cell.color, neighbor.color); \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/15a\/bb8\/1e6\/15abb81e60a35fb6383ff8be8b0a17dd.png\"><\/div>\n<p>  <i>\u0423\u0441\u0442\u0443\u043f\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0441\u043a\u043b\u043e\u043d\u0430\u0445.<\/i><\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-3\/connection-types\/connection-types.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u0423\u0433\u043b\u043e\u0432\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0443\u0441\u0442\u0443\u043f\u0430\u043c\u0438<\/h2>\n<p>  \u0423\u0433\u043b\u043e\u0432\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0440\u0451\u0431\u0435\u0440, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u043d\u0438\u0445 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435 \u0434\u0432\u0435, \u0430 \u0442\u0440\u0438 \u044f\u0447\u0435\u0439\u043a\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u0443\u0433\u043e\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0451\u043d \u0441 \u0442\u0440\u0435\u043c\u044f \u0440\u0451\u0431\u0440\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044f\u043c\u0438, \u0441\u043a\u043b\u043e\u043d\u0430\u043c\u0438 \u0438\u043b\u0438 \u043e\u0431\u0440\u044b\u0432\u0430\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0440\u0451\u0431\u0435\u0440, \u043d\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 <code>HexMesh<\/code> \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>  \u041d\u0430\u0448\u0435\u043c\u0443 \u043d\u043e\u0432\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0443\u0433\u043b\u043e\u0432\u043e\u0433\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u0435 \u044f\u0447\u0435\u0439\u043a\u0438. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0443\u044e \u0432\u044b\u0441\u043e\u0442\u0443. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043d\u0438\u0437\u0443 \u0432\u043b\u0435\u0432\u043e \u0438 \u0432\u043f\u0440\u0430\u0432\u043e.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b24\/351\/681\/b243516810fc9f0e8c44a5cb12f74cff.png\"><\/div>\n<p>  <i>\u0423\u0433\u043b\u043e\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435.<\/i><\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCorner ( \t\tVector3 bottom, HexCell bottomCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tAddTriangle(bottom, left, right); \t\tAddTriangleColor(bottomCell.color, leftCell.color, rightCell.color); \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c <code>TriangulateConnection<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0438\u0437 \u044f\u0447\u0435\u0435\u043a \u0441\u0430\u043c\u0430\u044f \u043d\u0438\u0436\u043d\u044f\u044f. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u043d\u0438\u0436\u0435 \u0441\u0432\u043e\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0438\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0441 \u0441\u0430\u043c\u043e\u0439 \u043d\u0438\u0436\u043d\u0435\u0439. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u043a\u0430\u043a \u0441\u0430\u043c\u0443\u044e \u043d\u0438\u0436\u043d\u044e\u044e \u044f\u0447\u0435\u0439\u043a\u0443.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateConnection ( \t\tHexDirection direction, HexCell cell, Vector3 v1, Vector3 v2 \t) { \t\t\u2026 \t\t \t\tHexCell nextNeighbor = cell.GetNeighbor(direction.Next()); \t\tif (direction &lt;= HexDirection.E &amp;&amp; nextNeighbor != null) { \t\t\tVector3 v5 = v2 + HexMetrics.GetBridge(direction.Next()); \t\t\tv5.y = nextNeighbor.Elevation * HexMetrics.elevationStep; \t\t\t \t\t\tif (cell.Elevation &lt;= neighbor.Elevation) { \t\t\t\tif (cell.Elevation &lt;= nextNeighbor.Elevation) { \t\t\t\t\tTriangulateCorner(v2, cell, v4, neighbor, v5, nextNeighbor); \t\t\t\t} \t\t\t} \t\t} \t}<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0430\u043c\u0430\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0443\u0434\u0430\u0447\u0435\u0439, \u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0439 \u043d\u0438\u0437\u043a\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u043e\u0441\u0435\u0434. \u0414\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043f\u0440\u043e\u0442\u0438\u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0438.<\/p>\n<pre><code class=\"cs\">\t\t\tif (cell.Elevation &lt;= neighbor.Elevation) { \t\t\t\tif (cell.Elevation &lt;= nextNeighbor.Elevation) { \t\t\t\t\tTriangulateCorner(v2, cell, v4, neighbor, v5, nextNeighbor); \t\t\t\t} \t\t\t\telse { \t\t\t\t\tTriangulateCorner(v5, nextNeighbor, v2, cell, v4, neighbor); \t\t\t\t} \t\t\t}<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u0435\u0439 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0434\u0432\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438. \u0415\u0441\u043b\u0438 \u0441\u043e\u0441\u0435\u0434 \u0440\u0435\u0431\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u043d\u0438\u0437\u043a\u0438\u043c, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u043f\u0440\u043e\u0442\u0438\u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u0439.<\/p>\n<pre><code class=\"cs\">\t\t\tif (cell.Elevation &lt;= neighbor.Elevation) { \t\t\t\tif (cell.Elevation &lt;= nextNeighbor.Elevation) { \t\t\t\t\tTriangulateCorner(v2, cell, v4, neighbor, v5, nextNeighbor); \t\t\t\t} \t\t\t\telse { \t\t\t\t\tTriangulateCorner(v5, nextNeighbor, v2, cell, v4, neighbor); \t\t\t\t} \t\t\t} \t\t\telse if (neighbor.Elevation &lt;= nextNeighbor.Elevation) { \t\t\t\tTriangulateCorner(v4, neighbor, v5, nextNeighbor, v2, cell); \t\t\t} \t\t\telse { \t\t\t\tTriangulateCorner(v5, nextNeighbor, v2, cell, v4, neighbor); \t\t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f8a\/736\/794\/f8a736794c4e52c54ab018dcd55feba0.png\"><\/div>\n<p>  <i>\u041f\u043e\u0432\u043e\u0440\u043e\u0442 \u043f\u0440\u043e\u0442\u0438\u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0438, \u043d\u0435\u0442 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430, \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435.<\/i><\/p>\n<h3>\u0422\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044f \u0441\u043a\u043b\u043e\u043d\u043e\u0432<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0433\u043e\u043b, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0440\u0451\u0431\u0435\u0440 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e. \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>HexCell<\/code> \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u043b\u043e\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 \u043b\u044e\u0431\u044b\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cs\">\tpublic HexEdgeType GetEdgeType (HexCell otherCell) { \t\treturn HexMetrics.GetEdgeType( \t\t\televation, otherCell.elevation \t\t); \t}<\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 <code>HexMesh.TriangulateCorner<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u043b\u0435\u0432\u043e\u0433\u043e \u0438 \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0440\u0451\u0431\u0435\u0440.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCorner ( \t\tVector3 bottom, HexCell bottomCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tHexEdgeType leftEdgeType = bottomCell.GetEdgeType(leftCell); \t\tHexEdgeType rightEdgeType = bottomCell.GetEdgeType(rightCell);  \t\tAddTriangle(bottom, left, right); \t\tAddTriangleColor(bottomCell.color, leftCell.color, rightCell.color); \t}<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043e\u0431\u0430 \u0440\u0435\u0431\u0440\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043a\u043b\u043e\u043d\u0430\u043c\u0438, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u0442\u0443\u043f\u044b \u0438 \u0441\u043b\u0435\u0432\u0430, \u0438 \u0441\u043f\u0440\u0430\u0432\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0438\u0436\u043d\u044f\u044f \u044f\u0447\u0435\u0439\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0439 \u043d\u0438\u0437\u043a\u043e\u0439, \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u0438 \u0441\u043a\u043b\u043e\u043d\u044b \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0432\u0432\u0435\u0440\u0445. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043b\u0435\u0432\u0430\u044f \u0438 \u043f\u0440\u0430\u0432\u0430\u044f \u044f\u0447\u0435\u0439\u043a\u0438 \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0432\u044b\u0441\u043e\u0442\u0443, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0440\u0435\u0431\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u043e\u0441\u043a\u0438\u043c. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u0430\u043a \u00ab\u0441\u043a\u043b\u043e\u043d-\u0441\u043a\u043b\u043e\u043d-\u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c\u00bb, \u0438\u043b\u0438 \u0421\u0421\u041f.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b75\/4a3\/f9e\/b754a3f9eccdb6baada2a51fef2c4301.png\"><\/div>\n<p>  <i>\u0414\u0432\u0430 \u0441\u043a\u043b\u043e\u043d\u0430 \u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u0421\u0421\u041f<\/i><\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043b\u0438 \u043c\u044b \u0432 \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u0438 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a, \u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>TriangulateCornerTerraces<\/code>. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430. \u0412\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0430\u0440\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0437\u0430\u043c\u0435\u043d\u0438\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCorner ( \t\tVector3 bottom, HexCell bottomCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tHexEdgeType leftEdgeType = bottomCell.GetEdgeType(leftCell); \t\tHexEdgeType rightEdgeType = bottomCell.GetEdgeType(rightCell);  \t\tif (leftEdgeType == HexEdgeType.Slope) { \t\t\tif (rightEdgeType == HexEdgeType.Slope) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tbottom, bottomCell, left, leftCell, right, rightCell \t\t\t\t); \t\t\t\treturn; \t\t\t} \t\t}  \t\tAddTriangle(bottom, left, right); \t\tAddTriangleColor(bottomCell.color, leftCell.color, rightCell.color); \t} \t \tvoid TriangulateCornerTerraces ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\t \t}<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438 <code>TriangulateCornerTerraces<\/code>, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0433\u043b\u043e\u0432\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0434\u0432\u0443\u043c\u044f \u0441\u043a\u043b\u043e\u043d\u0430\u043c\u0438 \u0441\u0442\u0430\u043d\u0443\u0442 \u043f\u0443\u0441\u0442\u043e\u0442\u0430\u043c\u0438. \u0421\u0442\u0430\u043d\u0435\u0442 \u043b\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u043e\u0442\u043e\u0439, \u0438\u043b\u0438 \u043d\u0435\u0442, \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0430\u044f \u0438\u0437 \u044f\u0447\u0435\u0435\u043a \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0438\u0436\u043d\u0435\u0439.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/26b\/a54\/2ea\/26ba542eaed793e064e478cbdbc5f109.png\"><\/div>\n<p>  <i>\u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0443\u0441\u0442\u043e\u0442\u0430.<\/i><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0442\u0443, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043b\u0435\u0432\u044b\u0439 \u0438 \u043f\u0440\u0430\u0432\u044b\u0439 \u0443\u0441\u0442\u0443\u043f \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b. \u041f\u043e\u0434\u0445\u043e\u0434 \u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0438 \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0440\u0451\u0431\u0435\u0440, \u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0440\u0451\u0445\u0446\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0432\u0443\u0445\u0446\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043d\u043e\u0432\u0430 \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCornerTerraces ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tVector3 v3 = HexMetrics.TerraceLerp(begin, left, 1); \t\tVector3 v4 = HexMetrics.TerraceLerp(begin, right, 1); \t\tColor c3 = HexMetrics.TerraceLerp(beginCell.color, leftCell.color, 1); \t\tColor c4 = HexMetrics.TerraceLerp(beginCell.color, rightCell.color, 1);  \t\tAddTriangle(begin, v3, v4); \t\tAddTriangleColor(beginCell.color, c3, c4); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ebf\/a76\/823\/ebfa76823e5dba45fd97daa1f052b1fb.png\"><\/div>\n<p>  <i>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/i><\/p>\n<p>  \u0418 \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u0441\u0440\u0430\u0437\u0443 \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u044d\u0442\u0430\u043f\u0443. \u042d\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0439 \u0442\u0440\u0430\u043f\u0435\u0446\u043e\u0438\u0434. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0440\u0451\u0431\u0435\u0440 \u0437\u0434\u0435\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u043d\u0435 \u0441 \u0434\u0432\u0443\u043c\u044f, \u0430 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u0446\u0432\u0435\u0442\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cs\">\t\tAddTriangle(begin, v3, v4); \t\tAddTriangleColor(beginCell.color, c3, c4);  \t\tAddQuad(v3, v4, left, right); \t\tAddQuadColor(c3, c4, leftCell.color, rightCell.color);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/99e\/ab2\/20b\/99eab220bcbdda36896dbb1640995b33.png\"><\/div>\n<p>  <i>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/i><\/p>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u0430\u043f\u044b \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cs\">\t\tAddTriangle(begin, v3, v4); \t\tAddTriangleColor(beginCell.color, c3, c4);  \t\tfor (int i = 2; i &lt; HexMetrics.terraceSteps; i++) { \t\t\tVector3 v1 = v3; \t\t\tVector3 v2 = v4; \t\t\tColor c1 = c3; \t\t\tColor c2 = c4; \t\t\tv3 = HexMetrics.TerraceLerp(begin, left, i); \t\t\tv4 = HexMetrics.TerraceLerp(begin, right, i); \t\t\tc3 = HexMetrics.TerraceLerp(beginCell.color, leftCell.color, i); \t\t\tc4 = HexMetrics.TerraceLerp(beginCell.color, rightCell.color, i); \t\t\tAddQuad(v1, v2, v3, v4); \t\t\tAddQuadColor(c1, c2, c3, c4); \t\t}  \t\tAddQuad(v3, v4, left, right); \t\tAddQuadColor(c3, c4, leftCell.color, rightCell.color);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b46\/8bb\/c69\/b468bbc6989ae33c9a810f5e641f2446.png\"><\/div>\n<p>  <i>\u0412\u0441\u0435 \u044d\u0442\u0430\u043f\u044b.<\/i><\/p>\n<h3>\u0412\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0441 \u0434\u0432\u0443\u043c\u044f \u0441\u043a\u043b\u043e\u043d\u0430\u043c\u0438<\/h3>\n<p>  \u0421\u043b\u0443\u0447\u0430\u0439 \u0441 \u0434\u0432\u0443\u043c\u044f \u0441\u043a\u043b\u043e\u043d\u0430\u043c\u0438 \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044f\u043c\u0438, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u043c\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0430\u044f \u0438\u0437 \u044f\u0447\u0435\u0435\u043a \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0438\u0436\u043d\u0435\u0439. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0438\u0445, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043b\u0435\u0432\u044b\u0445-\u043f\u0440\u0430\u0432\u044b\u0445 \u043d\u0430 \u0441\u043a\u043b\u043e\u043d-\u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c-\u0441\u043a\u043b\u043e\u043d.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b17\/736\/3ca\/b177363ca9391a96905ce2a0717020d9.png\"><\/div>\n<p>  <i>\u0421\u041f\u0421 \u0438 \u041f\u0421\u0421.<\/i><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u043e\u0435 \u0440\u0435\u0431\u0440\u043e \u043f\u043b\u043e\u0441\u043a\u043e\u0435, \u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0443\u043f\u044b \u0441\u043b\u0435\u0432\u0430, \u0430 \u043d\u0435 \u0441\u043d\u0438\u0437\u0443. \u0415\u0441\u043b\u0438 \u043b\u0435\u0432\u043e\u0435 \u0440\u0435\u0431\u0440\u043e \u043f\u043b\u043e\u0441\u043a\u043e\u0435, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441\u043f\u0440\u0430\u0432\u0430.<\/p>\n<pre><code class=\"cs\">\t\tif (leftEdgeType == HexEdgeType.Slope) { \t\t\tif (rightEdgeType == HexEdgeType.Slope) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tbottom, bottomCell, left, leftCell, right, rightCell \t\t\t\t); \t\t\t\treturn; \t\t\t} \t\t\tif (rightEdgeType == HexEdgeType.Flat) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tleft, leftCell, right, rightCell, bottom, bottomCell \t\t\t\t); \t\t\t\treturn; \t\t\t} \t\t} \t\tif (rightEdgeType == HexEdgeType.Slope) { \t\t\tif (leftEdgeType == HexEdgeType.Flat) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tright, rightCell, bottom, bottomCell, left, leftCell \t\t\t\t); \t\t\t\treturn; \t\t\t} \t\t}<\/code><\/pre>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u0443\u0441\u0442\u0443\u043f\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0433\u0438\u0431\u0430\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438 \u0431\u0435\u0437 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0439\u0434\u0443\u0442 \u0434\u043e \u043e\u0431\u0440\u044b\u0432\u0430 \u0438\u043b\u0438 \u043a\u043e\u043d\u0446\u0430 \u043a\u0430\u0440\u0442\u044b.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4d8\/359\/68c\/4d835968ce882e260a2b4f7ec23979ab.png\"><\/div>\n<p>  <i>\u0421\u043f\u043b\u043e\u0448\u043d\u044b\u0435 \u0443\u0441\u0442\u0443\u043f\u044b.<\/i><\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-3\/terraced-corner-connections\/terraced-corner-connections.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/p>\n<h2>\u0421\u043b\u0438\u044f\u043d\u0438\u0435 \u0441\u043a\u043b\u043e\u043d\u043e\u0432 \u0438 \u043e\u0431\u0440\u044b\u0432\u043e\u0432<\/h2>\n<p>  \u0410 \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0451\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u043b\u043e\u043d\u0430 \u0438 \u043e\u0431\u0440\u044b\u0432\u0430? \u0415\u0441\u043b\u0438 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043b\u0435\u0432\u043e\u0435 \u0440\u0435\u0431\u0440\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043a\u043b\u043e\u043d\u043e\u043c, \u0430 \u043f\u0440\u0430\u0432\u043e\u0435 \u2014 \u043e\u0431\u0440\u044b\u0432\u043e\u043c, \u0442\u043e \u043a\u0430\u043a\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0440\u0445\u043d\u0435\u0435 \u0440\u0435\u0431\u0440\u043e? \u041e\u043d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043b\u043e\u0441\u043a\u0438\u043c, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043b\u0438 \u0441\u043a\u043b\u043e\u043d\u043e\u043c, \u0438\u043b\u0438 \u043e\u0431\u0440\u044b\u0432\u043e\u043c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/dd9\/6bc\/0d3\/dd96bc0d3fb89e029687c7b9c9312cc5.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/049\/07d\/d22\/04907dd22fc5da80ba59fa2dbb6abb82.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/463\/24c\/c57\/46324cc57e9c3e79a21378c932e09ed9.png\"><\/div>\n<p>  <i>\u0421\u041e\u0421 \u0438 \u0421\u041e\u041e.<\/i><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u00ab\u0441\u043a\u043b\u043e\u043d-\u043e\u0431\u0440\u044b\u0432\u00bb.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCornerTerracesCliff ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\t \t}<\/code><\/pre>\n<p>  \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 <code>TriangulateCorner<\/code>, \u043a\u043e\u0433\u0434\u0430 \u043b\u0435\u0432\u043e\u0435 \u0440\u0435\u0431\u0440\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043a\u043b\u043e\u043d\u043e\u043c.<\/p>\n<pre><code class=\"cs\">\t\tif (leftEdgeType == HexEdgeType.Slope) { \t\t\tif (rightEdgeType == HexEdgeType.Slope) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tbottom, bottomCell, left, leftCell, right, rightCell \t\t\t\t); \t\t\t\treturn; \t\t\t} \t\t\tif (rightEdgeType == HexEdgeType.Flat) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tleft, leftCell, right, rightCell, bottom, bottomCell \t\t\t\t); \t\t\t\treturn; \t\t\t} \t\t\tTriangulateCornerTerracesCliff( \t\t\t\tbottom, bottomCell, left, leftCell, right, rightCell \t\t\t); \t\t\treturn; \t\t} \t\tif (rightEdgeType == HexEdgeType.Slope) { \t\t\tif (leftEdgeType == HexEdgeType.Flat) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tright, rightCell, bottom, bottomCell, left, leftCell \t\t\t\t); \t\t\t\treturn; \t\t\t} \t\t}<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u044d\u0442\u043e \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c? \u042d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438: \u043d\u0438\u0436\u043d\u044e\u044e \u0438 \u0432\u0435\u0440\u0445\u043d\u044e\u044e.<\/p>\n<h3>\u041d\u0438\u0436\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c<\/h3>\n<p>  \u041d\u0438\u0436\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u0443\u0441\u0442\u0443\u043f\u044b \u0441\u043b\u0435\u0432\u0430 \u0438 \u043e\u0431\u0440\u044b\u0432 \u0441\u043f\u0440\u0430\u0432\u0430. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0445 \u043a\u0430\u043a-\u0442\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c. \u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0441\u0436\u0430\u0432 \u0443\u0441\u0442\u0443\u043f\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438\u0441\u044c \u0432 \u043f\u0440\u0430\u0432\u043e\u043c \u0443\u0433\u043b\u0443. \u042d\u0442\u043e \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u0442 \u0443\u0441\u0442\u0443\u043f\u044b \u0432\u0432\u0435\u0440\u0445.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d11\/8e7\/d53\/d118e7d538c25cba75a31ca37c6096cc.png\"><\/div>\n<p>  <i>\u0421\u0436\u0430\u0442\u0438\u0435 \u0443\u0441\u0442\u0443\u043f\u043e\u0432.<\/i><\/p>\n<p>  \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u0432 \u043f\u0440\u0430\u0432\u043e\u043c \u0443\u0433\u043b\u0443, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442 \u0443\u0441\u0442\u0443\u043f\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0432\u0435\u0440\u0445\u0443. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441 \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0438\u043c \u043e\u0431\u0440\u044b\u0432\u043e\u043c, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0437\u043a\u043e \u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0438 \u0442\u043e\u043d\u043a\u0438\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0436\u043c\u0451\u043c \u0438\u0445 \u0432 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043b\u0435\u0436\u0438\u0442 \u0432\u0434\u043e\u043b\u044c \u043e\u0431\u0440\u044b\u0432\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/df5\/131\/efa\/df5131efa8069569630306b4cc8eb9b6.png\"><\/div>\n<p>  <i>\u0421\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0435.<\/i><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u043d\u0430 \u043e\u0434\u0438\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u044b\u0448\u0435 \u043d\u0438\u0436\u043d\u0435\u0439 \u044f\u0447\u0435\u0439\u043a\u0438. \u041d\u0430\u0439\u0442\u0438 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0435\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0441\u043e\u0442.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCornerTerracesCliff ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tfloat b = 1f \/ (rightCell.Elevation - beginCell.Elevation); \t\tVector3 boundary = Vector3.Lerp(begin, right, b); \t\tColor boundaryColor = Color.Lerp(beginCell.color, rightCell.color, b); \t}<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0435\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u043e\u043a\u0440\u043e\u0435\u043c \u0432\u0441\u044e \u043d\u0438\u0436\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c \u043e\u0434\u043d\u0438\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c.<\/p>\n<pre><code class=\"cs\">\t\tfloat b = 1f \/ (rightCell.Elevation - beginCell.Elevation); \t\tVector3 boundary = Vector3.Lerp(begin, right, b); \t\tColor boundaryColor = Color.Lerp(beginCell.color, rightCell.color, b);  \t\tAddTriangle(begin, left, boundary); \t\tAddTriangleColor(beginCell.color, leftCell.color, boundaryColor);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/03e\/534\/ab9\/03e534ab927d5709aca721ccfd9bdc80.png\"><\/div>\n<p>  <i>\u041d\u0438\u0436\u043d\u0438\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a.<\/i><\/p>\n<p>  \u0420\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0432 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438 \u0443\u0441\u0442\u0443\u043f\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043d\u043e\u0432\u0430 \u043d\u0430\u0447\u043d\u0451\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430.<\/p>\n<pre><code class=\"cs\">\t\tfloat b = 1f \/ (rightCell.Elevation - beginCell.Elevation); \t\tVector3 boundary = Vector3.Lerp(begin, right, b); \t\tColor boundaryColor = Color.Lerp(beginCell.color, rightCell.color, b);  \t\tVector3 v2 = HexMetrics.TerraceLerp(begin, left, 1); \t\tColor c2 = HexMetrics.TerraceLerp(beginCell.color, leftCell.color, 1);  \t\tAddTriangle(begin, v2, boundary); \t\tAddTriangleColor(beginCell.color, c2, boundaryColor);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6c2\/4fc\/3c1\/6c24fc3c19580573b89d3259b855a692.png\"><\/div>\n<p>  <i>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u0441\u0436\u0430\u0442\u0438\u044f.<\/i><\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c.<\/p>\n<pre><code class=\"cs\">\t\tAddTriangle(begin, v2, boundary); \t\tAddTriangleColor(beginCell.color, c2, boundaryColor);  \t\tAddTriangle(v2, left, boundary); \t\tAddTriangleColor(c2, leftCell.color, boundaryColor);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/035\/6db\/5cb\/0356db5cbaf4bd936ea4235af34eb1d3.png\"><\/div>\n<p>  <i>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f \u0441\u0436\u0430\u0442\u0438\u044f.<\/i><\/p>\n<p>  \u0418 \u0432\u0441\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u044d\u0442\u0430\u043f\u044b \u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cs\">\t\tAddTriangle(begin, v2, boundary); \t\tAddTriangleColor(beginCell.color, c2, boundaryColor);  \t\tfor (int i = 2; i &lt; HexMetrics.terraceSteps; i++) { \t\t\tVector3 v1 = v2; \t\t\tColor c1 = c2; \t\t\tv2 = HexMetrics.TerraceLerp(begin, left, i); \t\t\tc2 = HexMetrics.TerraceLerp(beginCell.color, leftCell.color, i); \t\t\tAddTriangle(v1, v2, boundary); \t\t\tAddTriangleColor(c1, c2, boundaryColor); \t\t}  \t\tAddTriangle(v2, left, boundary); \t\tAddTriangleColor(c2, leftCell.color, boundaryColor);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6e6\/987\/744\/6e698774450ec3502f52537936d8a29e.png\"><\/div>\n<p>  <i>\u0421\u0436\u0430\u0442\u044b\u0435 \u0443\u0441\u0442\u0443\u043f\u044b.<\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0430\u0437\u0432\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0443\u0441\u0442\u0443\u043f\u043e\u0432?<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443\u0441\u0442\u0443\u043f\u044b \u043f\u043b\u043e\u0441\u043a\u0438\u043c\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0438 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0430\u043c\u0438, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0434\u043b\u044f \u0441\u043a\u043b\u043e\u043d\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0443\u0441\u0442\u0443\u043f\u0430\u043c\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u0438 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u0445 \u043b\u0435\u0432\u0430\u044f \u0438 \u043f\u0440\u0430\u0432\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043d\u0430\u043a\u043b\u043e\u043d. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0435\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e.<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0443\u0433\u043b\u0430<\/h3>\n<p>  \u0417\u0430\u043a\u043e\u043d\u0447\u0438\u0432 \u043d\u0438\u0436\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0432\u0435\u0440\u0445\u043d\u0435\u0439. \u0415\u0441\u043b\u0438 \u0432\u0435\u0440\u0445\u043d\u0435\u0435 \u0440\u0435\u0431\u0440\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043a\u043b\u043e\u043d\u043e\u043c, \u0442\u043e \u043d\u0430\u043c \u0441\u043d\u043e\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0443\u0441\u0442\u0443\u043f\u044b \u0438 \u043e\u0431\u0440\u044b\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCornerTerracesCliff ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tfloat b = 1f \/ (rightCell.Elevation - beginCell.Elevation); \t\tVector3 boundary = Vector3.Lerp(begin, right, b); \t\tColor boundaryColor = Color.Lerp(beginCell.color, rightCell.color, b);  \t\tTriangulateBoundaryTriangle( \t\t\tbegin, beginCell, left, leftCell, boundary, boundaryColor \t\t); \t}  \tvoid TriangulateBoundaryTriangle ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 boundary, Color boundaryColor \t) { \t\tVector3 v2 = HexMetrics.TerraceLerp(begin, left, 1); \t\tColor c2 = HexMetrics.TerraceLerp(beginCell.color, leftCell.color, 1);  \t\tAddTriangle(begin, v2, boundary); \t\tAddTriangleColor(beginCell.color, c2, boundaryColor);  \t\tfor (int i = 2; i &lt; HexMetrics.terraceSteps; i++) { \t\t\tVector3 v1 = v2; \t\t\tColor c1 = c2; \t\t\tv2 = HexMetrics.TerraceLerp(begin, left, i); \t\t\tc2 = HexMetrics.TerraceLerp(beginCell.color, leftCell.color, i); \t\t\tAddTriangle(v1, v2, boundary); \t\t\tAddTriangleColor(c1, c2, boundaryColor); \t\t}  \t\tAddTriangle(v2, left, boundary); \t\tAddTriangleColor(c2, leftCell.color, boundaryColor); \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e. \u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043a\u043b\u043e\u043d, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0432\u0451\u0440\u043d\u0443\u0442\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0433\u0440\u0430\u043d\u0438\u0446\u044b. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCornerTerracesCliff ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tfloat b = 1f \/ (rightCell.Elevation - beginCell.Elevation); \t\tVector3 boundary = Vector3.Lerp(begin, right, b); \t\tColor boundaryColor = Color.Lerp(beginCell.color, rightCell.color, b); \t\t \t\tTriangulateBoundaryTriangle( \t\t\tbegin, beginCell, left, leftCell, boundary, boundaryColor \t\t);  \t\tif (leftCell.GetEdgeType(rightCell) == HexEdgeType.Slope) { \t\t\tTriangulateBoundaryTriangle( \t\t\t\tleft, leftCell, right, rightCell, boundary, boundaryColor \t\t\t); \t\t} \t\telse { \t\t\tAddTriangle(left, right, boundary); \t\t\tAddTriangleColor(leftCell.color, rightCell.color, boundaryColor); \t\t} \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/bc5\/ed2\/8fb\/bc5ed28fbb4a1a1f0015dafac63f5ec0.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/59c\/45b\/241\/59c45b2413d30e196fc195796e4b07e5.png\"><\/div>\n<p>  <i>\u0417\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u0430\u044f \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044f \u043e\u0431\u0435\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439.<\/i><\/p>\n<h3>\u0417\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438<\/h3>\n<p>  \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0438 \u00ab\u0441\u043a\u043b\u043e\u043d-\u043e\u0431\u0440\u044b\u0432\u00bb. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0435\u0449\u0451 \u0438 \u0434\u0432\u0430 \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f, \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0435\u0432\u0430 \u0435\u0441\u0442\u044c \u043e\u0431\u0440\u044b\u0432.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c00\/726\/f4f\/c00726f4fc6ef078b33782047f4e6b4d.png\"><\/div>\n<p>  <i>\u041e\u0421\u0421 \u0438 \u041e\u0421\u041e.<\/i><\/p>\n<p>  \u041c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c, \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043e\u0442\u043b\u0438\u0447\u0438\u044f\u043c\u0438 \u0438\u0437-\u0437\u0430 \u0441\u043c\u0435\u043d\u044b \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <code>TriangulateCornerTerracesCliff<\/code> \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCornerCliffTerraces ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tfloat b = 1f \/ (leftCell.Elevation - beginCell.Elevation); \t\tVector3 boundary = Vector3.Lerp(begin, left, b); \t\tColor boundaryColor = Color.Lerp(beginCell.color, leftCell.color, b);  \t\tTriangulateBoundaryTriangle( \t\t\tright, rightCell, begin, beginCell, boundary, boundaryColor \t\t);  \t\tif (leftCell.GetEdgeType(rightCell) == HexEdgeType.Slope) { \t\t\tTriangulateBoundaryTriangle( \t\t\t\tleft, leftCell, right, rightCell, boundary, boundaryColor \t\t\t); \t\t} \t\telse { \t\t\tAddTriangle(left, right, boundary); \t\t\tAddTriangleColor(leftCell.color, rightCell.color, boundaryColor); \t\t} \t}<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u0438 \u0432 <code>TriangulateCorner<\/code>.<\/p>\n<pre><code class=\"cs\">\t\tif (leftEdgeType == HexEdgeType.Slope) { \t\t\t\u2026 \t\t} \t\tif (rightEdgeType == HexEdgeType.Slope) { \t\t\tif (leftEdgeType == HexEdgeType.Flat) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tright, rightCell, bottom, bottomCell, left, leftCell \t\t\t\t); \t\t\t\treturn; \t\t\t} \t\t\tTriangulateCornerCliffTerraces( \t\t\t\tbottom, bottomCell, left, leftCell, right, rightCell \t\t\t); \t\t\treturn; \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3d9\/a9b\/7e6\/3d9a9b7e606cefd475ca14f53a48a683.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/323\/495\/6f4\/3234956f44e8bcbd63d055a9a7f89c36.png\"><\/div>\n<p>  <i>\u0422\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u041e\u0421\u0421 \u0438 \u041e\u0421\u041e.<\/i><\/p>\n<h3>\u0414\u0432\u043e\u0439\u043d\u044b\u0435 \u043e\u0431\u0440\u044b\u0432\u044b<\/h3>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u043d\u0435\u043f\u043b\u043e\u0441\u043a\u0438\u043c\u0438 \u0441\u043b\u0443\u0447\u0430\u044f\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0438\u0436\u043d\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 \u0441 \u043e\u0431\u0440\u044b\u0432\u0430\u043c\u0438 \u043f\u043e \u043e\u0431\u0435\u0438\u043c \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u043c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u0435 \u0440\u0435\u0431\u0440\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c \u2014 \u043f\u043b\u043e\u0441\u043a\u0438\u043c, \u0441\u043a\u043b\u043e\u043d\u043e\u043c \u0438\u043b\u0438 \u043e\u0431\u0440\u044b\u0432\u043e\u043c. \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0443\u0447\u0430\u0439 \u00ab\u043e\u0431\u0440\u044b\u0432-\u043e\u0431\u0440\u044b\u0432-\u0441\u043a\u043b\u043e\u043d\u00bb, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u0442\u0443\u043f\u044b.<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u00ab\u043e\u0431\u0440\u044b\u0432-\u043e\u0431\u0440\u044b\u0432-\u0441\u043a\u043b\u043e\u043d\u00bb, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0432\u044b\u0448\u0435. \u041e\u043d\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u0438\u0445 \u043a\u0430\u043a \u041e\u041e\u0421\u041f \u0438 \u041e\u041e\u0421\u041b.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b9f\/038\/df7\/b9f038df7a7d23da542430652adbd038.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3c3\/0b2\/013\/3c30b2013db25c9288ad551ec529c07b.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7ae\/e0d\/151\/7aee0d1512d324b1bd3c8e91f1b4134d.png\"><\/div>\n<p>  <i>\u041e\u041e\u0421\u041f \u0438 \u041e\u041e\u0421\u041b.<\/i><\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u043e\u0431\u0430 \u0441\u043b\u0443\u0447\u0430\u044f \u0432 <code>TriangulateCorner<\/code>, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u044b <code>TriangulateCornerCliffTerraces<\/code> \u0438 <code>TriangulateCornerTerracesCliff<\/code> \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430\u043c\u0438 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<pre><code class=\"cs\">\t\tif (leftEdgeType == HexEdgeType.Slope) { \t\t\t\u2026 \t\t} \t\tif (rightEdgeType == HexEdgeType.Slope) { \t\t\t\u2026 \t\t} \t\tif (leftCell.GetEdgeType(rightCell) == HexEdgeType.Slope) { \t\t\tif (leftCell.Elevation &lt; rightCell.Elevation) { \t\t\t\tTriangulateCornerCliffTerraces( \t\t\t\t\tright, rightCell, bottom, bottomCell, left, leftCell \t\t\t\t); \t\t\t} \t\t\telse { \t\t\t\tTriangulateCornerTerracesCliff( \t\t\t\t\tleft, leftCell, right, rightCell, bottom, bottomCell \t\t\t\t); \t\t\t} \t\t\treturn; \t\t}<\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u0430\u044f \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044f. \u0422\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0441\u0432\u0435\u0440\u0445\u0443 \u0432\u043d\u0438\u0437. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0448\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f, \u0447\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0442\u043e\u0440\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u043b\u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCornerTerracesCliff ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tfloat b = 1f \/ (rightCell.Elevation - beginCell.Elevation); \t\tif (b &lt; 0) { \t\t\tb = -b; \t\t} \t\t\u2026 \t}  \tvoid TriangulateCornerCliffTerraces ( \t\tVector3 begin, HexCell beginCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tfloat b = 1f \/ (leftCell.Elevation - beginCell.Elevation); \t\tif (b &lt; 0) { \t\t\tb = -b; \t\t} \t\t\u2026 \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ae8\/f3d\/bf8\/ae8f3dbf8d5e2781cff2437d8ce4ad70.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/710\/922\/0aa\/7109220aa668eae0d9904f48d7bd30ee.png\"><\/div>\n<p>  <i>\u0422\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u041e\u041e\u0421\u041f \u0438 \u041e\u041e\u0421\u041b.<\/i><\/p>\n<h3>\u041f\u043e\u0434\u0447\u0438\u0441\u0442\u043a\u0430<\/h3>\n<p>  \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0435 \u043e\u0441\u043e\u0431\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044e \u0443\u0441\u0442\u0443\u043f\u043e\u0432.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/dc2\/280\/86f\/dc228086f73f694a351ec127e0e75e45.png\"><\/div>\n<p>  <i>\u0417\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u0430\u044f \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u044f \u0441 \u0443\u0441\u0442\u0443\u043f\u0430\u043c\u0438.<\/i><\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c <code>TriangulateCorner<\/code>, \u0438\u0437\u0431\u0430\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 <code>return<\/code> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0438\u0445 \u0431\u043b\u043e\u043a\u0438 <code>else<\/code>.<\/p>\n<pre><code class=\"cs\">\tvoid TriangulateCorner ( \t\tVector3 bottom, HexCell bottomCell, \t\tVector3 left, HexCell leftCell, \t\tVector3 right, HexCell rightCell \t) { \t\tHexEdgeType leftEdgeType = bottomCell.GetEdgeType(leftCell); \t\tHexEdgeType rightEdgeType = bottomCell.GetEdgeType(rightCell);  \t\tif (leftEdgeType == HexEdgeType.Slope) { \t\t\tif (rightEdgeType == HexEdgeType.Slope) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tbottom, bottomCell, left, leftCell, right, rightCell \t\t\t\t); \t\t\t} \t\t\telse if (rightEdgeType == HexEdgeType.Flat) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tleft, leftCell, right, rightCell, bottom, bottomCell \t\t\t\t); \t\t\t} \t\t\telse { \t\t\t\tTriangulateCornerTerracesCliff( \t\t\t\t\tbottom, bottomCell, left, leftCell, right, rightCell \t\t\t\t); \t\t\t} \t\t} \t\telse if (rightEdgeType == HexEdgeType.Slope) { \t\t\tif (leftEdgeType == HexEdgeType.Flat) { \t\t\t\tTriangulateCornerTerraces( \t\t\t\t\tright, rightCell, bottom, bottomCell, left, leftCell \t\t\t\t); \t\t\t} \t\t\telse { \t\t\t\tTriangulateCornerCliffTerraces( \t\t\t\t\tbottom, bottomCell, left, leftCell, right, rightCell \t\t\t\t); \t\t\t} \t\t} \t\telse if (leftCell.GetEdgeType(rightCell) == HexEdgeType.Slope) { \t\t\tif (leftCell.Elevation &lt; rightCell.Elevation) { \t\t\t\tTriangulateCornerCliffTerraces( \t\t\t\t\tright, rightCell, bottom, bottomCell, left, leftCell \t\t\t\t); \t\t\t} \t\t\telse { \t\t\t\tTriangulateCornerTerracesCliff( \t\t\t\t\tleft, leftCell, right, rightCell, bottom, bottomCell \t\t\t\t); \t\t\t} \t\t} \t\telse { \t\t\tAddTriangle(bottom, left, right); \t\t\tAddTriangleColor(bottomCell.color, leftCell.color, rightCell.color); \t\t} \t}<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0431\u043b\u043e\u043a <code>else<\/code> \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0449\u0451 \u043d\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u044b \u0440\u0430\u043d\u0435\u0435. \u042d\u0442\u0438\u043c\u0438 \u0441\u043b\u0443\u0447\u0430\u044f\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u041f\u041f\u041f (\u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c-\u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c-\u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c), \u041e\u041e\u041f, \u041e\u041e\u041e\u0420 \u0438 \u041e\u041e\u041e\u041b. \u0412\u0441\u0435 \u043e\u043d\u0438 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/944\/4da\/58b\/9444da58b33b9558b88fa8bb80102e34.png\"><\/div>\n<p>  <i>\u0412\u0441\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438.<\/i><\/p>\n<p>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/hex-map\/part-3\/merging-slopes-and-cliffs\/merging-slopes-and-cliffs.unitypackage\" rel=\"nofollow\">unitypackage<\/a><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/424257\/\"> https:\/\/habr.com\/post\/424257\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/305\/0b2\/d11\/3050b2d115d1ec49e2b6c945ab9ed4c1.jpg\" alt=\"image\"><\/div>\n<p>  <i>\u041e\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430: \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u0435\u0440\u0432\u0430\u044f \u0438\u0437 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 (27 \u0447\u0430\u0441\u0442\u0435\u0439) \u0441\u0435\u0440\u0438\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u0430\u0440\u0442 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0412\u043e\u0442, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432.<\/i><\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c1: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u043a\u0438 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432<\/h1>\n<p>  <\/p>\n<h2>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0432 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438.<\/li>\n<li>\u0422\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0442\u043a\u0443 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/li>\n<li>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043a\u0443\u0431\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.<\/li>\n<li>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u0441 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438 \u0441\u0435\u0442\u043a\u0438.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0432\u043d\u0443\u0442\u0440\u0438\u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440.<\/li>\n<\/ul>\n<p>  \u042d\u0442\u043e\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0441\u0435\u0440\u0438\u0438 \u043e \u043a\u0430\u0440\u0442\u0430\u0445 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0421\u0435\u0442\u043a\u0438 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0438\u0433\u0440\u0430\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f\u0445, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 Age of Wonders 3, Civilization 5 \u0438 Endless Legend. \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043e\u0441\u043d\u043e\u0432, \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0440\u0435\u043b\u044c\u0435\u0444 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0448\u0435\u0441\u0442\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-290082","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=290082"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290082\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=290082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=290082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=290082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}