{"id":279359,"date":"2016-04-29T13:15:04","date_gmt":"2016-04-29T09:15:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=279359"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=279359","title":{"rendered":"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0436\u0435\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0442\u0430\u0447\u0441\u043a\u0440\u0438\u043d\u0430"},"content":{"rendered":"<p>       \u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u043b\u0430 \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043b\u0438\u0447\u043d\u0430\u044f \u0438\u0433\u0440\u0430 \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445. \u0421\u0443\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0440\u0430\u0433\u043e\u0432 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0436\u0435\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u043b\u044c\u0446\u0430\u043c\u0438. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439, \u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0434\u043a\u043e. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0437\u0443\u043c-\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043f\u0430\u043b\u044c\u0446\u0435\u0432, \u0432\u0440\u043e\u0434\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0433\u0440\u044b \u0432\u044b\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<ul>\n<li>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0441\u0436\u0430\u0442\u0438\u0435 \u0447\u0435\u043b\u044e\u0441\u0442\u0435\u0439;<\/li>\n<li>\u0421\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u0436\u0435\u0432\u0430\u043d\u0438\u044f \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u043c;<\/li>\n<li>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e \u0445\u043e\u0434\u0443 \u0442\u0435\u0441\u0442\u043e\u0432.<\/li>\n<\/ul>\n<p>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0441# \u0434\u043b\u044f \u0434\u0432\u0438\u0436\u043a\u0430 Unity3D, \u0434\u043b\u044f 2\u0414 \u0438\u0433\u0440\u044b. \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043a\u043e\u0434\u0443. \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 Update \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043a\u043e\u043b-\u0432\u043e \u0442\u0430\u0447\u0435\u0439, \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0414\u0432\u0438\u0433\u0430\u0435\u043c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cs\">\/\/\u0415\u0441\u043b\u0438 \u043e\u0434\u043d\u043e \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0435 if (Input.touchCount == 1) { \/\/\u0415\u0441\u043b\u0438 \u0447\u0435\u043b\u044e\u0441\u0442\u0438 \u043d\u0435 \u0441\u0436\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0438\u043b\u0438 \u043d\u0435 \u0440\u0430\u0437\u0436\u0438\u043c\u0430\u044e\u0442\u0441\u044f, \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043a \u043c\u0435\u0441\u0442\u0443 \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u044f \tif (!compressing && !decompressing) {  \t\tTouch singleTouch = Input.GetTouch(0); \t\tVector3 targetPoint = Camera.main.ScreenToWorldPoint (singleTouch.position); \t\ttargetPoint = new Vector3 (targetPoint.x, targetPoint.y, 0); \t\ttransform.position = Vector3.MoveTowards (transform.position, targetPoint, movementSpeed * Time.deltaTime); \t} } <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u041a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0432\u0443\u0445 \u043a\u0430\u0441\u0430\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0441\u0436\u0438\u043c\u0430\u043d\u0438\u044f\/\u0440\u0430\u0437\u0436\u0438\u043c\u0430\u043d\u0438\u044f \u0447\u0435\u043b\u044e\u0441\u0442\u0435\u0439, \u0442\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u0445 \u043f\u0430\u043b\u044c\u0446\u0435\u0432.<\/p>\n<pre><code class=\"cs\">if (Input.touchCount &gt; 1) {         \/\/\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u043a\u0430\u0441\u0430\u043d\u0438\u044f\u043c\u0438.         Touch touch1 = Input.GetTouch(0); \tTouch touch2 = Input.GetTouch(1);         \/\/\u0415\u0441\u043b\u0438 \u0447\u0435\u043b\u044e\u0441\u0442\u0438 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u043b\u044c\u0446\u0430\u043c\u0438 \tif (!compressing && !decompressing) { \t\tVector3 targetPoint = Camera.main.ScreenToWorldPoint ((touch1.position + touch2.position) \/ 2); \t\ttargetPoint = new Vector3 (targetPoint.x, targetPoint.y, 0); \t\ttransform.position = Vector3.MoveTowards (transform.position, targetPoint, movementSpeed * Time.deltaTime); \t}          float currentDistance = Vector2.Distance(touch1.position, touch2.position);         if(pastFingersDistance == 0) {                 \/\/\u041e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u0437\u0430\u0441\u0435\u0447\u0435\u043d\u043e \u0434\u0432\u0430 \u0442\u0430\u0447\u0430 \t\tpastFingersDistance = currentDistance;  \t}else if(currentDistance &lt; pastFingersDistance - fingersMunchDetectionMin) {                  \/\/\u041c\u0435\u0442\u043e\u0434 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0447\u0435\u043b\u044e\u0441\u0442\u0435\u0439. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439, \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e. \t\tSetCompression();  \t}else if(currentDistance &gt; pastFingersDistance + fingersMunchDetectionMin) {                 \/\/\u041c\u0435\u0442\u043e\u0434 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0436\u0430\u0442\u0438\u044f \u0447\u0435\u043b\u044e\u0441\u0442\u0435\u0439. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439, \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e. \t\tSetDecompression();  \t} } \/\/\u041e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0436\u0435\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u0430\u043b\u044c\u0446\u0435\u0432. if(Input.touchCount &lt; 2) pastFingersDistance = 0; \/\/\u0415\u0441\u043b\u0438 \u043a\u0430\u0441\u0430\u043d\u0438\u0439 \u0441\u0442\u0430\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0432\u0443\u0445, \u0430 \u0447\u0435\u043b\u044e\u0441\u0442\u0438 \u0441\u0436\u0430\u0442\u044b - \u043e\u043d\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0437\u0436\u0438\u043c\u0430\u044e\u0442\u0441\u044f. if(Input.touchCount &lt; 2 && isCompressed)  SetDecompression();  <\/code><\/pre>\n<p>  <i>fingersMunchDetectionMin<\/i> \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u043a\u0430\u043a\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0436\u0435\u0432\u0430\u043d\u0438\u0435. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043b\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0440\u0443\u0437\u0435\u0439. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043d\u043e\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u0435, \u0432\u044b\u0432\u0435\u043b \u043d\u0435\u0447\u0442\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0435. \u0412 \u0445\u043e\u0434\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0436\u0435\u0432\u0430\u0442\u044c \u043f\u0430\u043b\u044c\u0446\u0430\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e. \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0436\u0438\u043c\u0430\u043d\u0438\u0435 \u0447\u0435\u043b\u044e\u0441\u0442\u0435\u0439 \u043f\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0442\u0430\u043f\u0443 \u0438 \u043c\u0435\u0442\u043e\u0434, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435, \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"cs\">if (Input.touchCount &gt; 1) {         \/\/\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u043a\u0430\u0441\u0430\u043d\u0438\u044f\u043c\u0438. \tTouch touch1 = Input.GetTouch(0); \tTouch touch2 = Input.GetTouch(1);         \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0435\u0441\u043b\u0438 \u0447\u0435\u043b\u044e\u0441\u0442\u0438 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \tif (!compressing && !decompressing) {  \t\tfloat touch1Time = 0; \t\tfloat touch2Time = 0;                 \/\/\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0430\u043a\u0442\u0438\u0432\u0435\u043d \u0442\u0430\u0447 1 \t\tif (tapsHash.Contains (touch1.fingerId)) { \t\t\tfloat startTouch1Time = (float) tapsHash [touch1.fingerId]; \t\t\ttouch1Time = Time.time - startTouch1Time; \t\t}                 \/\/\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0430\u043a\u0442\u0438\u0432\u0435\u043d \u0442\u0430\u0447 2 \t\tif (tapsHash.Contains (touch2.fingerId)) { \t\t\tfloat startTouch2Time = (float) tapsHash [touch2.fingerId]; \t\t\ttouch2Time = Time.time - startTouch2Time; \t\t}                 \/\/\u0415\u0441\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0442\u0430\u043f \u0443\u0436\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u043e \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u043f\u0430\u043b\u044c\u0446\u0435\u0432, \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u043b\u044c\u0446\u0430\u043c\u0438. \t\tif (touch1Time &gt; SECONDS_FOR_TAP && touch2Time &gt; SECONDS_FOR_TAP) { \t\t\tVector3 targetPoint = Camera.main.ScreenToWorldPoint ((touch1.position + touch2.position) \/ 2); \t\t\ttargetPoint = new Vector3 (targetPoint.x, targetPoint.y, 0); \t\t\ttransform.position = Vector3.MoveTowards (transform.position, targetPoint, movementSpeed * Time.deltaTime); \t\t} \t} \tfloat currentDistance = Vector2.Distance(touch1.position, touch2.position);         if(pastFingersDistance == 0) {                 \/\/\u041e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u0437\u0430\u0441\u0435\u0447\u0435\u043d\u043e \u0434\u0432\u0430 \u0442\u0430\u0447\u0430 \t\tpastFingersDistance = currentDistance;  \t}else if(currentDistance &lt; pastFingersDistance - fingersMunchDetectionMin) {                  \/\/\u041c\u0435\u0442\u043e\u0434 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0447\u0435\u043b\u044e\u0441\u0442\u0435\u0439. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439, \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e. \t\tSetCompression();  \t}else if(currentDistance &gt; pastFingersDistance + fingersMunchDetectionMin) {                  \/\/\u041c\u0435\u0442\u043e\u0434 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0436\u0430\u0442\u0438\u044f \u0447\u0435\u043b\u044e\u0441\u0442\u0435\u0439. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439, \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e. \t\tSetDecompression(); \t} } \/\/\u041e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0436\u0435\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u0430\u043b\u044c\u0446\u0435\u0432. if(Input.touchCount &lt; 2) pastFingersDistance = 0; \/\/\u0415\u0441\u043b\u0438 \u043a\u0430\u0441\u0430\u043d\u0438\u0439 \u0441\u0442\u0430\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0432\u0443\u0445, \u0430 \u0447\u0435\u043b\u044e\u0441\u0442\u0438 \u0441\u0436\u0430\u0442\u044b - \u043e\u043d\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0437\u0436\u0438\u043c\u0430\u044e\u0442\u0441\u044f. if(Input.touchCount &lt; 2 && isCompressed)  SetDecompression();  \/\/\u041c\u0435\u0442\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u0436\u0435\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u0442\u0430\u043f\u0443. SetTapAttackListener (); <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 SECONDS_FOR_TAP \u2014 \u0432\u0440\u0435\u043c\u044f, \u043e\u0442\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0442\u0430\u043f, \u043a\u0430\u043a \u0438 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430 \u0436\u0435\u0432\u0430\u043d\u0438\u0435, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043b\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b\u0430\u0441\u044c. \u041d\u0443 \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442 \u0436\u0435\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0442\u0430\u043f\u0443:<\/p>\n<pre><code class=\"cs\">void SetTapAttackListener() { \tif (Input.touchCount &gt; 0) { \t\tforeach (Touch touch in Input.touches) {                         \/\/\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0442\u0430\u0447\u0430 \t\t\tDetectOneTouchTap (touch);  \t\t} \t} }  void DetectOneTouchTap(Touch touch) { \tif (touch.phase == TouchPhase.Began) {                 \/\/\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0442\u0430\u0447 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b\u0441\u044f, \u043e\u043d \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0445\u044d\u0448-\u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.                 \/\/\u041a\u043b\u044e\u0447 - \u0438\u0434 \u0442\u0430\u0447\u0430, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 - \u043d\u0430\u0447\u0430\u043b\u043e \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u044f. \t\ttapsHash.Add (touch.fingerId, Time.time);  \t} else if(touch.phase == TouchPhase.Ended) { \t\tfloat startTouchTime = (float) tapsHash [touch.fingerId]; \t\tfloat timeOfTouch = Time.time - startTouchTime;                 \/\/\u041e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0436\u0430\u0442\u0438\u044f \u0438 \u0440\u0430\u0437\u0436\u0430\u0442\u0438\u044f \u0447\u0435\u043b\u044e\u0441\u0442\u0435\u0439, \u0435\u0441\u043b\u0438 \u0442\u0430\u0447 \u0431\u044b\u043b \u0442\u0430\u043f\u043e\u043c \t\tif (timeOfTouch &lt;= SECONDS_FOR_TAP) { \t\t\tSetCompression(); \t\t\tSetDecompression(); \t\t} \t\ttapsHash.Remove (touch.fingerId); \t} } <\/code><\/pre>\n<p>  \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0441\u0435\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430, \u043d\u0435 \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0430, \u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u0445\u043e\u0434\u0430 \u043c\u044b\u0441\u043b\u0435\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0438 \u0440\u0435\u0448\u0438\u043b \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u043e\u043c\u043e\u0449\u044c \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c. \u0421\u0435\u0439\u0447\u0430\u0441 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u0438\u0436\u0443, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u0430\u043e\u0442\u0438\u0447\u0435\u043d, \u043d\u0443 \u0430 \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u2014 \u0436\u0434\u0443 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \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:\/\/habrahabr.ru\/post\/282752\/\"> https:\/\/habrahabr.ru\/post\/282752\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u043b\u0430 \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043b\u0438\u0447\u043d\u0430\u044f \u0438\u0433\u0440\u0430 \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445. \u0421\u0443\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0440\u0430\u0433\u043e\u0432 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0436\u0435\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u043b\u044c\u0446\u0430\u043c\u0438. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439, \u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0434\u043a\u043e. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0437\u0443\u043c-\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043f\u0430\u043b\u044c\u0446\u0435\u0432, \u0432\u0440\u043e\u0434\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0433\u0440\u044b \u0432\u044b\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438.  <\/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-279359","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/279359","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=279359"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/279359\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=279359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=279359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=279359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}