{"id":292772,"date":"2019-07-30T15:00:52","date_gmt":"2019-07-30T15:00:52","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=292772"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=292772","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u0433\u0440\u044b Tower Defense \u0432 Unity: \u0431\u0430\u043b\u043b\u0438\u0441\u0442\u0438\u043a\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">[<a href=\"https:\/\/habr.com\/ru\/post\/449798\/\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a>, <a href=\"https:\/\/habr.com\/ru\/post\/452756\/\">\u0432\u0442\u043e\u0440\u0430\u044f<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/post\/459070\/\">\u0442\u0440\u0435\u0442\u044c\u044f<\/a> \u0447\u0430\u0441\u0442\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430]<\/p>\n<ul>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0431\u0430\u0448\u0435\u043d.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u0448\u043d\u0438-\u043c\u043e\u0440\u0442\u0438\u0440\u044b.<\/li>\n<li>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u0431\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0439.<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a \u0432\u0437\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432.<\/li>\n<\/ul>\n<p>  \u042d\u0442\u043e \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u0433\u0440\u044b \u0432 \u0436\u0430\u043d\u0440\u0435 <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/tower-defense\/\">tower defense<\/a>. \u0412 \u043d\u0435\u0439 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0431\u0430\u0448\u043d\u0438-\u043c\u043e\u0440\u0442\u0438\u0440\u044b, \u0441\u0442\u0440\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u0434\u0435\u0442\u043e\u043d\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0440\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0441\u043d\u0430\u0440\u044f\u0434\u0430\u043c\u0438.<\/p>\n<p>  \u0422\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u0432 Unity 2018.4.4f1.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cee\/22b\/b28\/cee22bb28fd043b06a81d046b1ca6ea8.jpg\" width=\"512\" height=\"256\"><\/div>\n<p>  <i>\u0412\u0440\u0430\u0433\u0438 \u043f\u043e\u0434\u0432\u0435\u0440\u0433\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043c\u0431\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u043a\u0435.<\/i><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0422\u0438\u043f\u044b \u0431\u0430\u0448\u0435\u043d<\/h2>\n<p>  \u041b\u0430\u0437\u0435\u0440 \u2014 \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043d\u0430 \u0431\u0430\u0448\u043d\u0435. \u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0442\u0438\u043f \u0431\u0430\u0448\u0435\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u0435\u043b\u044f\u0442\u044c \u0432\u0437\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u043f\u0440\u0438 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u0441\u043d\u0430\u0440\u044f\u0434\u0430\u043c\u0438, \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0430\u044e\u0449\u0438\u043c\u0438 \u0432\u0441\u0435\u0445 \u0432\u0440\u0430\u0433\u043e\u0432 \u043f\u043e\u0431\u043b\u0438\u0437\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0431\u0430\u0448\u0435\u043d.<\/p>\n<h3>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u0431\u0430\u0448\u043d\u044f<\/h3>\n<p>  \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0446\u0435\u043b\u0438 \u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0430\u044f \u0431\u0430\u0448\u043d\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0451 \u0432 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0431\u0430\u0448\u0435\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u043c <code>Tower<\/code>, \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>LaserTower<\/code>. \u0417\u0430\u0442\u0435\u043c \u0443\u0434\u0430\u043b\u0438\u043c \u0438\u0437 <code>Tower<\/code> \u0432\u0435\u0441\u044c \u043a\u043e\u0434, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0439\u0441\u044f \u043a \u043b\u0430\u0437\u0435\u0440\u0443. \u0411\u0430\u0448\u043d\u044f \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0446\u0435\u043b\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0434\u0430\u043b\u0438\u043c \u043f\u043e\u043b\u0435 <code>target<\/code> \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043c <code>AcquireTarget<\/code> \u0438 <code>TrackTarget<\/code> \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0441\u0441\u044b\u043b\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440. \u0417\u0430\u0442\u0435\u043c \u0443\u0434\u0430\u043b\u0438\u043c \u0438\u0437 <code>OnDrawGizmosSelected<\/code> \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0446\u0435\u043b\u0438, \u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0431\u0430\u0448\u0435\u043d.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public abstract class Tower : GameTileContent {  \tconst int enemyLayerMask = 1 &lt;&lt; 9;  \tstatic Collider[] targetsBuffer = new Collider[100];  \t[SerializeField, Range(1.5f, 10.5f)] \tprotected float targetingRange = 1.5f;  \tprotected bool AcquireTarget (out TargetPoint target) { \t\t\u2026 \t}  \tprotected bool TrackTarget (ref TargetPoint target) { \t\t\u2026 \t}  \tvoid OnDrawGizmosSelected () { \t\tGizmos.color = Color.yellow; \t\tVector3 position = transform.localPosition; \t\tposition.y += 0.01f; \t\tGizmos.DrawWireSphere(position, targetingRange); \t} }<\/code><\/pre>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0438\u043c \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u0432 <code>LaserTower<\/code>, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 <code>Tower<\/code>, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0435\u0433\u043e \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0438\u0437\u0431\u0430\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u043e\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public class LaserTower : Tower {  \t[SerializeField, Range(1f, 100f)] \tfloat damagePerSecond = 10f;  \t[SerializeField] \tTransform turret = default, laserBeam = default;  \tTargetPoint target;  \tVector3 laserBeamScale;  \tvoid Awake () { \t\tlaserBeamScale = laserBeam.localScale; \t}  \tpublic override void GameUpdate () { \t\tif (TrackTarget(ref target) || AcquireTarget(out target)) { \t\t\tShoot(); \t\t} \t\telse { \t\t\tlaserBeam.localScale = Vector3.zero; \t\t} \t}  \tvoid Shoot () { \t\t\u2026 \t}  }<\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u043f\u0440\u0435\u0444\u0430\u0431 \u043b\u0430\u0437\u0435\u0440\u043d\u043e\u0439 \u0431\u0430\u0448\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f61\/cac\/322\/f61cac3227e3600f455bffca7ae3427a.png\" width=\"320\" height=\"130\"><\/div>\n<p>  <i>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043b\u0430\u0437\u0435\u0440\u043d\u043e\u0439 \u0431\u0430\u0448\u043d\u0438.<\/i><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0431\u0430\u0448\u0435\u043d<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u0430 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u043c\u044b\u0445 \u043d\u0430 \u043f\u043e\u043b\u0435 \u0431\u0430\u0448\u0435\u043d, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 <code>TowerType<\/code>, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 <code>GameTileContentType<\/code>. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0435\u0439\u0441\u044f \u043b\u0430\u0437\u0435\u0440\u043d\u043e\u0439 \u0431\u0430\u0448\u043d\u0438 \u0438 \u0431\u0430\u0448\u043d\u0438-\u043c\u043e\u0440\u0442\u0438\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<pre><code class=\"cs\">public enum TowerType { \tLaser, Mortar }<\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0431\u0430\u0448\u0435\u043d, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a <code>Tower<\/code> \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e-\u0433\u0435\u0442\u0442\u0435\u0440 \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0442\u0438\u043f\u0430. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0442\u0438\u043f\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0444\u0438\u0433\u0443\u0440\u044b \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/object-management\/\">Object Management<\/a>.<\/p>\n<pre><code class=\"cs\">\tpublic abstract TowerType TowerType\u20ac { get; }<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0435\u0433\u043e \u0432 <code>LaserTower<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f.<\/p>\n<pre><code class=\"cs\">\tpublic override TowerType TowerType\u20ac =&gt; TowerType.Laser;<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043c <code>GameTileContentFactory<\/code> \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043c\u043e\u0433\u043b\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0431\u0430\u0448\u043d\u044e \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0448\u0435\u043d \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>Get<\/code>, \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>TowerType<\/code>. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f\u043c\u0438 (assertions). \u0414\u0440\u0443\u0433\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>Get<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443 \u0442\u0430\u0439\u043b\u043e\u0432 \u0431\u0435\u0437 \u0431\u0430\u0448\u0435\u043d.<\/p>\n<pre><code class=\"cs\">\t[SerializeField] \tTower[] towerPrefabs = default;  \tpublic GameTileContent Get (GameTileContentType type) { \t\tswitch (type) { \t\t\t\u2026 \t\t} \t\tDebug.Assert(false, \"Unsupported non-tower type: \" + type); \t\treturn null; \t}  \tpublic GameTileContent Get (TowerType type) { \t\tDebug.Assert((int)type &lt; towerPrefabs.Length, \"Unsupported tower type!\"); \t\tTower prefab = towerPrefabs[(int)type]; \t\tDebug.Assert(type == prefab.TowerType\u20ac, \"Tower prefab at wrong index!\"); \t\treturn Get(prefab); \t}<\/code><\/pre>\n<p>  \u041b\u043e\u0433\u0438\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0438\u0434\u0435\u0430\u043b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>Get<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c <code>Tower<\/code>. \u041d\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>Get<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043f\u0440\u0435\u0444\u0430\u0431\u0430, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>GameTileContent<\/code>. \u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435, \u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>Get<\/code> \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u043c (generic). \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<pre><code class=\"cs\">\tpublic Tower Get (TowerType type) { \t\t\u2026 \t} \t \tT Get&lt;T&gt; (T prefab) where T : GameTileContent { \t\tT instance = CreateGameObjectInstance(prefab); \t\tinstance.OriginFactory = this; \t\treturn instance; \t}<\/code><\/pre>\n<p>  \u041f\u043e\u043a\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0430\u0437\u0435\u0440\u043d\u0430\u044f \u0431\u0430\u0448\u043d\u044f, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0451 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0448\u0435\u043d \u0444\u0430\u0431\u0440\u0438\u043a\u0438.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/13e\/b55\/14f\/13eb5514f027062301183f1142e99412.png\" width=\"320\" height=\"150\"><\/div>\n<p>  <i>\u041c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0435\u0444\u0430\u0431\u043e\u0432 \u0431\u0430\u0448\u0435\u043d.<\/i><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0431\u0430\u0448\u0435\u043d<\/h3>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0448\u043d\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043c <code>GameBoard.ToggleTower<\/code> \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>TowerType<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b \u0435\u0433\u043e \u0444\u0430\u0431\u0440\u0438\u043a\u0435.<\/p>\n<pre><code class=\"cs\">\tpublic void ToggleTower (GameTile tile, TowerType towerType) { \t\tif (tile.Content.Type == GameTileContentType.Tower\u20ac) { \t\t\t\u2026 \t\t} \t\telse if (tile.Content.Type == GameTileContentType.Empty) { \t\t\ttile.Content = contentFactory.Get(towerType); \t\t\t\u2026 \t\t} \t\telse if (tile.Content.Type == GameTileContentType.Wall) { \t\t\ttile.Content = contentFactory.Get(towerType); \t\t\tupdatingContent.Add(tile.Content); \t\t} \t}<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043d\u043e\u0432\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c: \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0430\u0448\u043d\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043d\u043e \u0431\u0430\u0448\u043d\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432. \u041f\u043e\u043a\u0430 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0431\u0430\u0448\u043d\u044e, \u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0437\u0430\u043c\u0435\u043d\u044f\u043b\u0430\u0441\u044c \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0430\u0439\u043b \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u043d\u044f\u0442\u044b\u043c, \u0442\u043e \u043f\u043e\u0438\u0441\u043a \u043f\u0443\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u043d\u043e\u0432\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<pre><code class=\"cs\">\t\tif (tile.Content.Type == GameTileContentType.Tower\u20ac) { \t\t\tupdatingContent.Remove(tile.Content); \t\t\tif (((Tower)tile.Content).TowerType\u20ac == towerType) { \t\t\t\ttile.Content = contentFactory.Get(GameTileContentType.Empty); \t\t\t\tFindPaths(); \t\t\t} \t\t\telse { \t\t\t\ttile.Content = contentFactory.Get(towerType); \t\t\t\tupdatingContent.Add(tile.Content); \t\t\t} \t\t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c <code>Game<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u043e\u0439 \u0431\u0430\u0448\u043d\u0438. \u041c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0438\u043f \u0431\u0430\u0448\u0435\u043d \u0447\u0438\u0441\u043b\u043e\u043c. \u041b\u0430\u0437\u0435\u0440\u043d\u0430\u044f \u0431\u0430\u0448\u043d\u044f \u2014 \u044d\u0442\u043e 1, \u043e\u043d\u0430 \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u0430\u0448\u043d\u0435\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0430 \u0431\u0430\u0448\u043d\u044f-\u043c\u043e\u0440\u0442\u0438\u0440\u0430 \u2014 2. \u041d\u0430\u0436\u0438\u043c\u0430\u044f \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u0431\u0430\u0448\u0435\u043d.<\/p>\n<pre><code class=\"cs\">\tTowerType selectedTowerType;  \t\u2026  \tvoid Update () { \t\t\u2026 \t\tif (Input.GetKeyDown(KeyCode.G)) { \t\t\tboard.ShowGrid = !board.ShowGrid; \t\t}  \t\tif (Input.GetKeyDown(KeyCode.Alpha1)) { \t\t\tselectedTowerType = TowerType.Laser; \t\t} \t\telse if (Input.GetKeyDown(KeyCode.Alpha2)) { \t\t\tselectedTowerType = TowerType.Mortar; \t\t}  \t\t\u2026 \t} \t \t\u2026 \t \tvoid HandleTouch () { \t\tGameTile tile = board.GetTile(TouchRay); \t\tif (tile != null) { \t\t\tif (Input.GetKey(KeyCode.LeftShift)) { \t\t\t\tboard.ToggleTower(tile, selectedTowerType); \t\t\t} \t\t\telse { \t\t\t\tboard.ToggleWall(tile); \t\t\t} \t\t} \t}<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0411\u0430\u0448\u043d\u044f-\u043c\u043e\u0440\u0442\u0438\u0440\u0430<\/h3>\n<p>  \u0420\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0431\u0430\u0448\u043d\u044e-\u043c\u043e\u0440\u0442\u0438\u0440\u0443 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043d\u0435\u0451 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \u043f\u0440\u0435\u0444\u0430\u0431\u0430. \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 <code>MortarTower<\/code>. \u041c\u043e\u0440\u0442\u0438\u0440\u044b \u0438\u043c\u0435\u044e\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0441\u0442\u0440\u0435\u043b\u044c\u0431\u044b, \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u00ab\u0432\u044b\u0441\u0442\u0440\u0435\u043b\u044b \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443\u00bb. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u043e\u0440\u0442\u0438\u0440\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043c\u043e\u0433\u043b\u0430 \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public class MortarTower : Tower {  \t[SerializeField, Range(0.5f, 2f)] \tfloat shotsPerSecond = 1f;  \t[SerializeField] \tTransform mortar = default;  \tpublic override TowerType TowerType\u20ac =&gt; TowerType.Mortar; }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0435\u0444\u0430\u0431 \u0434\u043b\u044f \u0431\u0430\u0448\u043d\u0438-\u043c\u043e\u0440\u0442\u0438\u0440\u044b. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0432 \u043f\u0440\u0435\u0444\u0430\u0431 \u043b\u0430\u0437\u0435\u0440\u043d\u043e\u0439 \u0431\u0430\u0448\u043d\u0438 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0435\u0451 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0430\u0448\u043d\u0438. \u0417\u0430\u0442\u0435\u043c \u0438\u0437\u0431\u0430\u0432\u0438\u043c\u0441\u044f \u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0430\u0448\u043d\u0438 \u0438 \u043b\u0430\u0437\u0435\u0440\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0430. \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c <code>turret<\/code> \u0432 <code>mortar<\/code>, \u0441\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0451 \u0432\u043d\u0438\u0437, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0441\u0442\u043e\u044f\u043b\u0430 \u043f\u043e\u0432\u0435\u0440\u0445 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u0438\u0434\u0430\u0434\u0438\u043c \u0435\u0439 \u0441\u0432\u0435\u0442\u043b\u043e-\u0441\u0435\u0440\u044b\u0439 \u0446\u0432\u0435\u0442 \u0438 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u043c \u0435\u0451. \u041a\u043e\u043b\u043b\u0430\u0439\u0434\u0435\u0440 \u043c\u043e\u0440\u0442\u0438\u0440\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043a\u043e\u043b\u043b\u0430\u0439\u0434\u0435\u0440\u043e\u043c, \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u043d\u0430 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043c\u043e\u0440\u0442\u0438\u0440\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u042f \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043b \u043c\u043e\u0440\u0442\u0438\u0440\u0435 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c 3.5 \u0438 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 1 \u0432\u044b\u0441\u0442\u0440\u0435\u043b \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/16f\/fdf\/176\/16ffdf1760e7ba7c9fe8455e51e36e7e.png\" width=\"180\" height=\"180\" alt=\"scene\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ffd\/c8b\/db0\/ffdc8bdb0ac0b4f3d49b3f16fe0656a5.png\" width=\"226\" height=\"66\" alt=\"hierarchy\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/590\/8cf\/b18\/5908cfb180527766e93968d70e744b4d.png\" width=\"320\" height=\"112\" alt=\"inspector\"><\/div>\n<p>  <i>\u041f\u0440\u0435\u0444\u0430\u0431 \u0431\u0430\u0448\u043d\u0438-\u043c\u043e\u0440\u0442\u0438\u0440\u044b.<\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043c\u043e\u0440\u0442\u0438\u0440\u0430\u043c\u0438 (mortar)?<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0435\u0440\u0432\u044b\u0435 \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u043e\u0440\u0443\u0436\u0438\u044f \u043f\u043e \u0441\u0443\u0442\u0438 \u0431\u044b\u043b\u0438 \u0436\u0435\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0447\u0430\u0448\u0430\u043c\u0438, \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043d\u0430 \u0441\u0442\u0443\u043f\u044b (mortar), \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0435\u0441\u0442\u0438\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0430\u043b\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u044b.<\/div>\n<\/div>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u0435\u0444\u0430\u0431 \u043c\u043e\u0440\u0442\u0438\u0440\u044b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0444\u0430\u0431\u0440\u0438\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0431\u0430\u0448\u043d\u0438-\u043c\u043e\u0440\u0442\u0438\u0440\u044b \u043d\u0430 \u043f\u043e\u043b\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u044e\u0442.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1a0\/9bd\/029\/1a09bd029c089572ce9542aeb2eff599.png\" width=\"320\" height=\"74\" alt=\"inspector\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/78b\/7f1\/979\/78b7f19793909d4598161ac7cad87901.png\" width=\"230\" height=\"230\" alt=\"scene\"><\/div>\n<p>  <i>\u0414\u0432\u0430 \u0442\u0438\u043f\u0430 \u0431\u0430\u0448\u0435\u043d, \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439<\/i><\/p>\n<h2>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0439<\/h2>\n<p>  \u041c\u043e\u0440\u0442\u0438\u0440\u0430 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u043d\u0430\u0440\u044f\u0434 \u043f\u043e\u0434 \u0443\u0433\u043b\u043e\u043c, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u043e\u043d \u043f\u0440\u043e\u043b\u0435\u0442\u0430\u0435\u0442 \u043d\u0430\u0434 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0440\u0430\u0436\u0430\u0435\u0442 \u0446\u0435\u043b\u044c \u0441\u0432\u0435\u0440\u0445\u0443. \u041e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043d\u0430\u0440\u044f\u0434\u044b, \u0434\u0435\u0442\u043e\u043d\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0441 \u0446\u0435\u043b\u044c\u044e \u0438\u043b\u0438 \u043d\u0430\u0434 \u043d\u0435\u0439. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c, \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0446\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0432 \u0437\u0435\u043c\u043b\u044e, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0440\u044f\u0434\u044b \u0432\u0437\u0440\u044b\u0432\u0430\u043b\u0438\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u0438\u0445 \u0432\u044b\u0441\u043e\u0442\u0430 \u0441\u043d\u0438\u0437\u0438\u0442\u0441\u044f \u0434\u043e \u043d\u0443\u043b\u044f.<\/p>\n<h3>\u041f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0442\u044c \u043c\u043e\u0440\u0442\u0438\u0440\u0443, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0451 \u043d\u0430 \u0446\u0435\u043b\u044c \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0451 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0440\u044f\u0434 \u043f\u0440\u0438\u0437\u0435\u043c\u043b\u0438\u043b\u0441\u044f \u043d\u0430 \u043d\u0443\u0436\u043d\u043e\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0433\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438, \u0430 \u043d\u0435 \u0434\u0432\u0438\u0436\u0443\u0449\u0438\u0435\u0441\u044f \u0446\u0435\u043b\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0448\u0438\u0445 \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>MortarTower<\/code> \u043c\u0435\u0442\u043e\u0434 <code>GameUpdate<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>Launch<\/code>. \u0412\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u043c \u043c\u044b \u043f\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u0422\u043e\u0447\u043a\u0430 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u2014 \u044d\u0442\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043c\u043e\u0440\u0442\u0438\u0440\u044b \u0432 \u043c\u0438\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u0432\u044b\u0448\u0435 \u0437\u0435\u043c\u043b\u0438. \u0420\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u0442\u043e\u0447\u043a\u0443 \u0446\u0435\u043b\u0438 \u0432 \u0442\u0440\u0451\u0445 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 \u043e\u0442 \u043d\u0435\u0451 \u043f\u043e \u043e\u0441\u0438 X, \u0438 \u043e\u0431\u043d\u0443\u043b\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 Y, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0446\u0435\u043b\u0438\u043c\u0441\u044f \u0432 \u0437\u0435\u043c\u043b\u044e. \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u0442\u043e\u0447\u043a\u0438, \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0432 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0436\u0451\u043b\u0442\u0443\u044e \u043b\u0438\u043d\u0438\u044e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 <code>Debug.DrawLine<\/code>. \u041b\u0438\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0438\u043c\u043e\u0439 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0441\u0446\u0435\u043d\u044b \u043e\u0434\u0438\u043d \u043a\u0430\u0434\u0440, \u043d\u043e \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u043c\u044b \u0440\u0438\u0441\u0443\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u043b\u0438\u043d\u0438\u044e.<\/p>\n<pre><code class=\"cs\">\tpublic override void GameUpdate () { \t\tLaunch(); \t}  \tpublic void Launch () { \t\tVector3 launchPoint = mortar.position; \t\tVector3 targetPoint = new Vector3(launchPoint.x + 3f, 0f, launchPoint.z);  \t\tDebug.DrawLine(launchPoint, targetPoint, Color.yellow); \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cfc\/d13\/419\/cfcd134191102e009ca1c0702c473515.png\" width=\"310\" height=\"120\"><\/div>\n<p>  <i>\u0426\u0435\u043b\u0438\u043c\u0441\u044f \u0432 \u0442\u043e\u0447\u043a\u0443, \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u0430\u0448\u043d\u0438.<\/i><\/p>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u043b\u0438\u043d\u0438\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u0415\u0433\u043e \u0432\u0435\u0440\u0445\u043d\u044f\u044f \u043e\u0447\u043a\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043c\u043e\u0440\u0442\u0438\u0440\u044b. \u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0440\u0442\u0438\u0440\u044b \u044d\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2a7\/a0c\/c16\/2a7a0cc16e4da38af2923a811469ae92.svg\" alt=\"$\\begin{bmatrix}0\\\\0\\end{bmatrix}$\" data-tex=\"inline\"><\/math>. \u0422\u043e\u0447\u043a\u0430 \u043d\u0438\u0436\u0435, \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0430\u0448\u043d\u0438 \u2014 \u044d\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/dde\/513\/1c2\/dde5131c2a74bcf59de000a1bdd238cb.svg\" alt=\"$\\begin{bmatrix}0\\\\y\\end{bmatrix}$\" data-tex=\"inline\"><\/math>, \u0430 \u0442\u043e\u0447\u043a\u0430 \u0432 \u0446\u0435\u043b\u0438 \u2014 \u044d\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bbe\/cf0\/79b\/bbecf079b8fb062e0670f99ab60d508e.svg\" alt=\"$\\begin{bmatrix}x\\\\y\\end{bmatrix}$\" data-tex=\"inline\"><\/math>, \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/817\/b92\/407\/817b92407f764f57af9226e50cc788fd.svg\" alt=\"$x$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u0435\u043d 3, \u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9b3\/4c4\/da5\/9b34c4da5c757d4982bbd1b6f2e8998a.svg\" alt=\"$y$\" data-tex=\"inline\"><\/math> \u2014 \u044d\u0442\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043c\u043e\u0440\u0442\u0438\u0440\u044b \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cs\">\t\tVector3 launchPoint = mortar.position; \t\tVector3 targetPoint = new Vector3(launchPoint.x + 3f, 0f, launchPoint.z);  \t\tfloat x = 3f; \t\tfloat y = -launchPoint.y;<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ced\/090\/37c\/ced09037c908b7a17505e21674cca0b8.png\" width=\"225\" height=\"125\"><\/div>\n<p>  <i>\u0422\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f.<\/i><\/p>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0446\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0430\u0448\u043d\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 Z \u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u044b\u043c, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u043e\u0441\u0438 Y. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>Launch<\/code> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0438 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e XZ: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/63d\/7f5\/c20\/63d7f5c20c187fc8177667ae93003800.svg\" alt=\"$\\begin{bmatrix}3\\\\0\\end{bmatrix}$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/752\/1a8\/f1b\/7521a8f1bbe38f7dac6b1ddbb4b146e7.svg\" alt=\"$\\begin{bmatrix}0\\\\1\\end{bmatrix}$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/27b\/0fd\/219\/27b0fd219b09f87a3f4384c5512e7849.svg\" alt=\"$\\begin{bmatrix}1\\\\1\\end{bmatrix}$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/74d\/2d2\/5f4\/74d2d25f434db4051423f723e572154b.svg\" alt=\"$\\begin{bmatrix}3\\\\1\\end{bmatrix}$\" data-tex=\"inline\"><\/math>. \u041a\u043e\u0433\u0434\u0430 \u0442\u043e\u0447\u043a\u0430 \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u043f\u043b\u044e\u0441 \u044d\u0442\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u0435\u0451 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 Y \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u0439 \u043d\u0443\u043b\u044e.<\/p>\n<pre><code class=\"cs\">\tpublic override void GameUpdate () { \t\tLaunch(new Vector3(3f, 0f, 0f)); \t\tLaunch(new Vector3(0f, 0f, 1f)); \t\tLaunch(new Vector3(1f, 0f, 1f)); \t\tLaunch(new Vector3(3f, 0f, 1f)); \t}  \tpublic void Launch (Vector3 offset) { \t\tVector3 launchPoint = mortar.position; \t\tVector3 targetPoint = launchPoint + offset; \t\ttargetPoint.y = 0f; \t\t \t\t\u2026 \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c x \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0432\u0435\u043d \u0434\u043b\u0438\u043d\u0435 2D-\u0432\u0435\u043a\u0442\u043e\u0440\u0430, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0448\u043d\u0438 \u0432 \u0442\u043e\u0447\u043a\u0443 \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f. \u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0432 \u044d\u0442\u043e\u0442 \u0432\u0435\u043a\u0442\u043e\u0440, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u0435\u043a\u0442\u043e\u0440 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f XZ, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e, \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0432 \u043d\u0438\u0436\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043a\u0430\u043a \u0431\u0435\u043b\u0443\u044e \u043b\u0438\u043d\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0438\u0437 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 x.<\/p>\n<pre><code class=\"cs\">\t\tVector2 dir; \t\tdir.x = targetPoint.x - launchPoint.x; \t\tdir.y = targetPoint.z - launchPoint.z; \t\tfloat x = dir.magnitude; \t\tfloat y = -launchPoint.y; \t\tdir \/= x;  \t\tDebug.DrawLine(launchPoint, targetPoint, Color.yellow); \t\tDebug.DrawLine( \t\t\tnew Vector3(launchPoint.x, 0.01f, launchPoint.z), \t\t\tnew Vector3( \t\t\t\tlaunchPoint.x + dir.x * x, 0.01f, launchPoint.z + dir.y * x \t\t\t), \t\t\tColor.white \t\t);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a82\/307\/6b6\/a823076b66a14c4799be25436768a5b2.png\" width=\"310\" height=\"120\"><\/div>\n<p>  <i>\u0412\u044b\u0440\u043e\u0432\u043d\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f.<\/i><\/p>\n<h3>\u0423\u0433\u043e\u043b \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430<\/h3>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c \u0443\u0433\u043e\u043b, \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u0440\u0435\u043b\u044f\u0442\u044c \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u043c. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0438\u0437 \u0444\u0438\u0437\u0438\u043a\u0438 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u043d\u0430\u0440\u044f\u0434\u0430. \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043b\u043e\u0431\u043e\u0432\u043e\u0435 \u0441\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u0435, \u0432\u0435\u0442\u0435\u0440 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043c\u0435\u0445\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1c1\/778\/187\/1c1778187263268cc347012d16da61e2.svg\" alt=\"$v$\" data-tex=\"inline\"><\/math> \u0438 \u0433\u0440\u0430\u0432\u0438\u0442\u0430\u0446\u0438\u044e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/eec\/281\/2e5\/eec2812e56754cf9f9546e804872d34d.svg\" alt=\"$g = 9.81$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/35e\/a85\/36b\/35ea8536b3e6152e60442ccecbc46812.svg\" alt=\"$d$\" data-tex=\"inline\"><\/math> \u0441\u043d\u0430\u0440\u044f\u0434\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043b\u0438\u043d\u0438\u0438 \u0441 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0434\u0432\u0443\u043c\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438. \u0421 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u044d\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c07\/b02\/d12\/c07b02d1258984622d820c7426ec2cd9.svg\" alt=\"$d_x=v_xt$\" data-tex=\"inline\"><\/math>, \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9b0\/012\/4e4\/9b00124e411362185d05b841bc32695f.svg\" alt=\"$t$\" data-tex=\"inline\"><\/math> \u2014 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430. \u0421 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c \u0432\u0441\u0451 \u043f\u043e\u0445\u043e\u0436\u0435, \u0442\u043e \u043e\u043d \u043f\u043e\u0434\u0432\u0435\u0440\u0436\u0435\u043d \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044e \u0438\u0437-\u0437\u0430 \u0433\u0440\u0430\u0432\u0438\u0442\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/36e\/a41\/0d8\/36ea410d8243a8264951904d8f663b6f.svg\" alt=\"$d_y=v_yt-(g t^2)\/2$\" data-tex=\"inline\"><\/math>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f?<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1c1\/778\/187\/1c1778187263268cc347012d16da61e2.svg\" alt=\"$v$\" data-tex=\"inline\"><\/math> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043c\u043d\u043e\u0436\u0438\u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043d\u0430 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9b0\/012\/4e4\/9b00124e411362185d05b841bc32695f.svg\" alt=\"$t$\" data-tex=\"inline\"><\/math>, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6b8\/968\/574\/6b8968574d2cc3649de0994d19ce8d70.svg\" alt=\"$d=vt$\" data-tex=\"inline\"><\/math>. \u041a\u043e\u0433\u0434\u0430 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math>, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430. \u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0442\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0435. \u0412 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0432\u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e0a\/24a\/100\/e0a24a1001b4b8f7770b7ad32fa312d2.svg\" alt=\"$v=at$\" data-tex=\"inline\"><\/math>. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e90\/97d\/0f8\/e9097d0f8f2121b3b9f25ece9d6ef363.svg\" alt=\"$a=-g$\" data-tex=\"inline\"><\/math>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u043f\u043e\u043b\u0430\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u0438 \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c27\/bc8\/fb7\/c27bc8fb77e6596f9fb703b6dc2e88b2.svg\" alt=\"$d=(at^2)\/2$\" data-tex=\"inline\"><\/math>, \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u043e\u0435 \u0433\u0440\u0430\u0432\u0438\u0442\u0430\u0446\u0438\u0435\u0439.<\/div>\n<\/div>\n<p>  \u041c\u044b \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u043d\u0430\u0440\u044f\u0434\u044b \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f9d\/da2\/695\/f9dda26950cb67bd3ecef956c5341c14.svg\" alt=\"$s$\" data-tex=\"inline\"><\/math>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0443\u0433\u043b\u0430 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ff2\/c64\/99d\/ff2c6499d038a61a41d7ce75cd78788f.svg\" alt=\"$\\theta$\" data-tex=\"inline\"><\/math> (\u0442\u0435\u0442\u0430). \u0422\u043e \u0435\u0441\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8a1\/dcc\/4e6\/8a1dcc4e600f72a52742a9fa5d1b3f3b.svg\" alt=\"$v_x=s\\cos\\theta$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c15\/eb7\/373\/c15eb73731cae623a67c2e9384101f26.svg\" alt=\"$v_y=s\\sin\\theta$\" data-tex=\"inline\"><\/math>.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4a1\/ee3\/7ee\/4a1ee37ee06a0b9271cfc5dbab0e22aa.png\" width=\"225\" height=\"125\"><\/div>\n<p>  <i>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430.<\/i><\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/21e\/40f\/849\/21e40f849dc86ed627b17299bcaefff1.svg\" alt=\"$d_x=st\\cos\\theta$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/531\/93e\/285\/53193e285d432ccdd29d90cf0db27975.svg\" alt=\"$d_y=st\\sin\\theta-(g t^2)\/2$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u0421\u043d\u0430\u0440\u044f\u0434 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0435\u0433\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043b\u0451\u0442\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9b0\/012\/4e4\/9b00124e411362185d05b841bc32695f.svg\" alt=\"$t$\" data-tex=\"inline\"><\/math> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u0447\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u043e\u0439, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0441 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0449\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/130\/210\/12b\/13021012b4875a6c23f46821e045af48.svg\" alt=\"$t=d_x\/v_x$\" data-tex=\"inline\"><\/math>. \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0b7\/136\/75c\/0b713675cddf84d30ce2f0c32923412d.svg\" alt=\"$d_x=x$\" data-tex=\"inline\"><\/math>, \u0442\u043e \u0435\u0441\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1c6\/e6f\/5d1\/1c6e6f5d176413430d842a97e2406bc0.svg\" alt=\"$t=x\/(s\\cos\\theta)$\" data-tex=\"inline\"><\/math>. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/970\/85a\/f5e\/97085af5e06ea1615d3ef11a5dc70cff.svg\" alt=\"$y=x\\tan\\theta-(gx^2)\/(2s^2\\cos^2\\theta)$\" data-tex=\"inline\"><\/math>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 y?<\/b><\/p>\n<div class=\"spoiler_text\"><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ea1\/717\/df4\/ea1717df4c358c8226c58bc228cd44dc.svg\" alt=\"$y=d_y=s(x\/(s\\cos\\theta))\\sin\\theta-(g (x\/(s\\cos\\theta))^2)\/2=x\\sin\\theta\/\\cos\\theta-(gx^2)\/(2s^2\\cos^2\\theta)$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6a2\/b31\/c31\/6a2b31c319c151c7ce109e9009ab65f4.svg\" alt=\"$\\tan\\theta=\\sin\\theta\/\\cos\\theta$\" data-tex=\"inline\"><\/math>.<\/div>\n<\/div>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043c\u044b \u043d\u0430\u0439\u0434\u0451\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/780\/d55\/c8e\/780d55c8ed3f30699c021547b7d2217e.svg\" alt=\"$\\tan\\theta=(s^2+-\\sqrt{(s^4-g(gx^2+2ys^2))})\/(gx)$\" data-tex=\"inline\"><\/math>.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 tan \u03b8?<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0442\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u043e\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/667\/64a\/9d0\/66764a9d0090812076d7516770244f3f.svg\" alt=\"$\\sec\\theta=1\/\\cos\\theta$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1ba\/711\/f56\/1ba711f56d0ec9dfcd7923db586523cf.svg\" alt=\"$1+\\tan^2\\theta=\\sec^2\\theta$\" data-tex=\"inline\"><\/math>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0439\u0442\u0438 \u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e86\/de9\/352\/e86de935299e53ad5f993be266c3a92d.svg\" alt=\"$y=x\\tan\\theta-(gx^2)\/(2s^2)(1+\\tan^2\\theta)=-(gx^2)\/(2s^2)\\tan^2\\theta+x\\tan\\theta-(gx^2)\/(2s^2)$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u042d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8a1\/272\/cba\/8a1272cbac4b5442a690e12f75af3b18.svg\" alt=\"$au^2+bu+c=0$\" data-tex=\"inline\"><\/math>, \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6ac\/54a\/ab9\/6ac54aab9226990a3aa2053176465849.svg\" alt=\"$u=\\tan\\theta$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5da\/aee\/c9f\/5daaeec9fb9617aba8e12f1338f9dd1f.svg\" alt=\"$a=-(gx^2)\/(2s^2)$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/29b\/167\/7bd\/29b1677bdb554bd740feb0f861cf5ea6.svg\" alt=\"$b=x$\" data-tex=\"inline\"><\/math>, \u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b4d\/a46\/9be\/b4da469bedc9f36b00140bc4a757d899.svg\" alt=\"$c=a-y$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0448\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043a\u043e\u0440\u043d\u0435\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c78\/320\/0db\/c783200dbf46e7ec29cebb1f761d964b.svg\" alt=\"$u=(-b+-\\sqrt{(b^2-4ac)})\/(2a)$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0435\u0451 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u043c, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e, \u0434\u043e\u043c\u043d\u043e\u0436\u0438\u0432 \u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3fc\/a81\/297\/3fca812974fbf93a4a1ed0231822595f.svg\" alt=\"$m=s^2\/x$\" data-tex=\"inline\"><\/math> \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d76\/5d5\/bde\/d765d5bde2e24b6edb2c0dda075eceaa.svg\" alt=\"$\\tan\\theta=(-mb+-m\\sqrt{r})\/(2ma)$\" data-tex=\"inline\"><\/math>, \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ce4\/b7a\/2d2\/ce4b7a2d227e719a0c7d4692d532b9bb.svg\" alt=\"$r=b^2-4ac$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a38\/9bd\/da4\/a389bdda4572f3f0fc33dc8bf90bb5dc.svg\" alt=\"$\\tan\\theta=(s^2+-\\sqrt{(m^2r)})\/(gx)$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9ea\/31d\/af6\/9ea31daf680c1d3ac97007bd53d889a3.svg\" alt=\"$m^2r=(s^4\/x^2)r=s^4+2gs^2c=s^4-g^2x^2-2gys^2=s^4-g(gx^2+2ys^2)$\" data-tex=\"inline\"><\/math>.<\/div>\n<\/div>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0443\u0433\u043b\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0446\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u043e \u0438\u043b\u0438 \u043d\u0438\u0437\u043a\u043e. \u041d\u0438\u0437\u043a\u0430\u044f \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0430 \u0431\u043b\u0438\u0436\u0435 \u043a \u043f\u0440\u044f\u043c\u043e\u0439 \u043b\u0438\u043d\u0438\u0438 \u0434\u043e \u0446\u0435\u043b\u0438. \u041d\u043e \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u0435\u0451. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4a0\/c79\/46c\/4a0c7946c9a65371e8dd72209c81c7e1.svg\" alt=\"$\\tan\\theta=(s^2+\\sqrt{(s^4-g(gx^2+2ys^2))})\/(gx)$\" data-tex=\"inline\"><\/math>. \u0412\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u0435\u0433\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9cb\/be5\/628\/9cbbe5628da28095d079220a73b8f132.svg\" alt=\"$\\cos\\theta$\" data-tex=\"inline\"><\/math> \u0441 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0ef\/f70\/9d0\/0eff709d0dc6e33d22303db47949f0e5.svg\" alt=\"$\\sin\\theta$\" data-tex=\"inline\"><\/math>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b \u043d\u0430\u043c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/994\/f51\/5a1\/994f515a11e62672046299b8d9c4a1d1.svg\" alt=\"$\\tan\\theta$\" data-tex=\"inline\"><\/math> \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u043d\u044b\u0439 \u0443\u0433\u043e\u043b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>Mathf.Atan<\/code>. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 5.<\/p>\n<pre><code class=\"cs\">\t\tfloat x = dir.magnitude; \t\tfloat y = -launchPoint.y; \t\tdir \/= x;  \t\tfloat g = 9.81f; \t\tfloat s = 5f; \t\tfloat s2 = s * s;  \t\tfloat r = s2 * s2 - g * (g * x * x + 2f * y * s2); \t\tfloat tanTheta = (s2 + Mathf.Sqrt(r)) \/ (g * x); \t\tfloat cosTheta = Mathf.Cos(Mathf.Atan(tanTheta)); \t\tfloat sinTheta = cosTheta * tanTheta;<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0432 \u0434\u0435\u0441\u044f\u0442\u044c \u0441\u0438\u043d\u0438\u0445 \u043e\u0442\u0440\u0435\u0437\u043a\u043e\u0432, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043f\u043e\u043b\u0451\u0442\u0430.<\/p>\n<pre><code class=\"cs\">\t\tfloat sinTheta = cosTheta * tanTheta;  \t\tVector3 prev = launchPoint, next; \t\tfor (int i = 1; i &lt;= 10; i++) { \t\t\tfloat t = i \/ 10f; \t\t\tfloat dx = s * cosTheta * t; \t\t\tfloat dy = s * sinTheta * t - 0.5f * g * t * t; \t\t\tnext = launchPoint + new Vector3(dir.x * dx, dy, dir.y * dx); \t\t\tDebug.DrawLine(prev, next, Color.blue); \t\t\tprev = next; \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/154\/7e4\/fbb\/1547e4fbb9bf8e8bf81ebf18b6b3e390.png\" width=\"310\" height=\"160\"><\/div>\n<p>  <i>\u0422\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u0451\u0442\u0430 \u043f\u043e \u043f\u0430\u0440\u0430\u0431\u043e\u043b\u0435 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0434\u043d\u0443 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/i><\/p>\n<p>  \u0414\u0432\u0443\u0445 \u0441\u0430\u043c\u044b\u0445 \u0434\u0430\u043b\u044c\u043d\u0438\u0445 \u0442\u043e\u0447\u0435\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0438\u0445 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u0438 \u043e\u0442\u0440\u0435\u0437\u043a\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u0434 \u0437\u0435\u043c\u043b\u044e. \u0414\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0432\u0443\u0445 \u0442\u043e\u0447\u0435\u043a \u043d\u0443\u0436\u043d\u044b \u0431\u041e\u043b\u044c\u0448\u0438\u0435 \u0443\u0433\u043b\u044b \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0434\u043b\u0438\u043d\u043d\u0435\u0435, \u0430 \u043f\u043e\u043b\u0451\u0442 \u0434\u043b\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u044b.<\/p>\n<h3>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430<\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0434\u0432\u0443\u0445 \u0442\u043e\u0447\u0435\u043a \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0451 \u0440\u0430\u0432\u043d\u043e\u0439 4.<\/p>\n<pre><code class=\"cs\">\t\tfloat s = 4f;<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0ec\/429\/4a8\/0ec4294a8a6e4de20c57146413d6e5cc.png\" width=\"310\" height=\"140\"><\/div>\n<p>  <i>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u0441\u043d\u0438\u0436\u0435\u043d\u0430 \u0434\u043e 4.<\/i><\/p>\n<p>  \u0418\u0445 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b, \u043d\u043e \u0434\u0432\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u043f\u0430\u043b\u0438. \u0422\u0430\u043a \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0442\u043e\u0447\u0435\u043a. \u0412 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/994\/f51\/5a1\/994f515a11e62672046299b8d9c4a1d1.svg\" alt=\"$\\tan\\theta$\" data-tex=\"inline\"><\/math> \u043d\u0435\u0442, \u0442\u043e \u0435\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u0440\u0435\u043d\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0438\u0435 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c NaN \u0438 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044e \u043b\u0438\u043d\u0438\u0439. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/066\/939\/a33\/066939a33475dd671b845469b6526972.svg\" alt=\"$r$\" data-tex=\"inline\"><\/math> \u043d\u0430 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code class=\"cs\">\t\tfloat r = s2 * s2 - g * (g * x * x + 2f * y * s2); \t\tDebug.Assert(r &gt;= 0f, \"Launch velocity insufficient for range!\");<\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430. \u041d\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0442\u043e \u0434\u043b\u044f \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u043f\u043e \u0446\u0435\u043b\u044f\u043c \u0440\u044f\u0434\u043e\u043c \u0441 \u0431\u0430\u0448\u043d\u0435\u0439 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043b\u0451\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u0439. \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0432 \u0446\u0435\u043b\u044c \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u041f\u0440\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c50\/58b\/d5c\/c5058bd5c92bc9d6730e978cb3496b3c.svg\" alt=\"$r=0$\" data-tex=\"inline\"><\/math>, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u043b\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/994\/f51\/5a1\/994f515a11e62672046299b8d9c4a1d1.svg\" alt=\"$\\tan\\theta$\" data-tex=\"inline\"><\/math> \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u0439 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2e3\/ae1\/36e\/2e3ae136e726bc7aba26b1af741f1bd3.svg\" alt=\"$s=\\sqrt{(g(y+\\sqrt{(x^2+y^2)}))}$\" data-tex=\"inline\"><\/math>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f s?<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2f3\/39e\/1b9\/2f339e1b92194bdef67e7f47766d724e.svg\" alt=\"$s^4-g(gx^2+2ys^2)=s^4-2gys^2-g^2x^2=0$\" data-tex=\"inline\"><\/math> \u0434\u043b\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f9d\/da2\/695\/f9dda26950cb67bd3ecef956c5341c14.svg\" alt=\"$s$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u042d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8a1\/272\/cba\/8a1272cbac4b5442a690e12f75af3b18.svg\" alt=\"$au^2+bu+c=0$\" data-tex=\"inline\"><\/math>, \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cfa\/101\/121\/cfa10112146ad467333d1e35c5197a9b.svg\" alt=\"$u=s^2$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4f0\/0d4\/d82\/4f00d4d8255955ce3a3052a4eee5899c.svg\" alt=\"$a=1$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/367\/8e9\/3c3\/3678e93c398aaad79f0922eb359a4564.svg\" alt=\"$b=-2gy$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/170\/991\/8f4\/1709918f4d62b5e0fcb938153fb62f42.svg\" alt=\"$c=-g^2x^2$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043a\u043e\u0440\u043d\u0435\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3f1\/558\/f6e\/3f1558f6ee9423ac9f380c54602bee39.svg\" alt=\"$u=(-b+-\\sqrt{(b^2-4c)})\/2$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ef0\/50d\/5c3\/ef050d5c3e837038d33770c723e033c4.svg\" alt=\"$s^2=(2gy+-\\sqrt{(4g^2y^2+4g^2x^2)})\/2=gy+-g\\sqrt{(x^2+y^2)}$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043c \u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/708\/574\/5d9\/7085745d97b1eb49d48b85cf2c4ac3c0.svg\" alt=\"$s^2 = g(y+\\sqrt{(x^2+y^2)})$\" data-tex=\"inline\"><\/math>.<\/div>\n<\/div>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u0440\u043e\u0431\u0443\u0436\u0434\u0435\u043d\u0438\u0438 (Awake) \u043c\u043e\u0440\u0442\u0438\u0440\u044b \u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0451 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 Play. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0435\u0451 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e\u043b\u044f \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0435\u0451 \u0432 <code>Awake<\/code> \u0438 <code>OnValidate<\/code>.<\/p>\n<pre><code class=\"cs\">\tfloat launchSpeed;  \tvoid Awake () { \t\tOnValidate(); \t}  \tvoid OnValidate () { \t\tfloat x = targetingRange; \t\tfloat y = -mortar.position.y; \t\tlaunchSpeed = Mathf.Sqrt(9.81f * (y + Mathf.Sqrt(x * x + y * y))); \t}<\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u0437-\u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043c\u044b \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u043c \u043a \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0440\u0430\u0434\u0438\u0443\u0441 \u043a\u043e\u043b\u043b\u0430\u0439\u0434\u0435\u0440\u0430 \u0432\u0440\u0430\u0433\u0430 \u043f\u043e \u0441\u0443\u0442\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0430\u0448\u043d\u0438. \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0435\u0433\u043e \u0440\u0430\u0432\u043d\u044b\u043c 0.125, \u043d\u043e \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430 \u0432\u0440\u0430\u0433\u0430 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0443\u0434\u0432\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0435\u0449\u0451 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 0.25, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 0.25001.<\/p>\n<pre><code class=\"cs\">\t\tfloat x = targetingRange + 0.25001f;<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u0432 <code>Launch<\/code>.<\/p>\n<pre><code class=\"cs\">\t\tfloat s = launchSpeed;<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/760\/37c\/323\/76037c32335075486f9e84e231a98ca1.png\" width=\"310\" height=\"170\"><\/div>\n<p>  <i>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043a \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f 3.5.<\/i><\/p>\n<h3>\u0421\u0442\u0440\u0435\u043b\u044c\u0431\u0430<\/h3>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0446\u0435\u043b\u0435\u0439. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c <code>Launch<\/code> \u0442\u043e\u0447\u043a\u0443 \u0446\u0435\u043b\u0438.<\/p>\n<pre><code class=\"cs\">\tpublic void Launch (TargetPoint target) { \t\tVector3 launchPoint = mortar.position; \t\tVector3 targetPoint = target.Position; \t\ttargetPoint.y = 0f;  \t\t\u2026 \t}<\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0435 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0440\u0430\u0433\u043e\u0432 \u0438 \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0446\u0435\u043b\u044c, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0441\u0442\u0430\u043d\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u0432 <code>GameUpdate<\/code>. \u041d\u043e \u0432 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435 \u0431\u044b\u0442\u044c. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430, \u043d\u043e \u0431\u0435\u0437 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 1.<\/p>\n<pre><code class=\"cs\">\tfloat launchProgress;  \t\u2026  \tpublic override void GameUpdate () { \t\tlaunchProgress += shotsPerSecond * Time.deltaTime; \t\twhile (launchProgress &gt;= 1f) { \t\t\tif (AcquireTarget(out TargetPoint target)) { \t\t\t\tLaunch(target); \t\t\t\tlaunchProgress -= 1f; \t\t\t} \t\t\telse { \t\t\t\tlaunchProgress = 0.999f; \t\t\t} \t\t} \t}<\/code><\/pre>\n<p>  \u041c\u044b \u043d\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c \u0446\u0435\u043b\u0438 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430\u043c\u0438, \u043d\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043c\u043e\u0440\u0442\u0438\u0440\u0443 \u043f\u0440\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430\u0445. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u0434\u043b\u044f \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u043c\u043e\u0440\u0442\u0438\u0440\u044b \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>Quaternion.LookRotation<\/code>. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/994\/f51\/5a1\/994f515a11e62672046299b8d9c4a1d1.svg\" alt=\"$\\tan\\theta$\" data-tex=\"inline\"><\/math> \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0443\u0433\u043e\u043b \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 Y \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 1, \u0442\u043e \u0435\u0441\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/075\/e7d\/e8c\/075e7de8c41295d25c223a50f4774dd6.svg\" alt=\"$\\tan\\theta=\\sin\\theta$\" data-tex=\"inline\"><\/math>.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ad5\/3ab\/d92\/ad53abd9267080d707d8ac4fa2b4b219.png\" width=\"225\" height=\"125\"><\/div>\n<p>  <i>\u0420\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0432\u0437\u0433\u043b\u044f\u0434\u0430.<\/i><\/p>\n<pre><code class=\"cs\">\t\tfloat tanTheta = (s2 + Mathf.Sqrt(r)) \/ (g * x); \t\tfloat cosTheta = Mathf.Cos(Mathf.Atan(tanTheta)); \t\tfloat sinTheta = cosTheta * tanTheta; \t\t \t\tmortar.localRotation = \t\t\tQuaternion.LookRotation(new Vector3(dir.x, tanTheta, dir.y));<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u043e\u0432 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0431\u044b\u043b\u043e \u0432\u0438\u0434\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 <code>Debug.DrawLine<\/code> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u043c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<pre><code class=\"cs\">\t\tVector3 prev = launchPoint, next; \t\tfor (int i = 1; i &lt;= 10; i++) { \t\t\t\u2026 \t\t\tDebug.DrawLine(prev, next, Color.blue, 1f); \t\t\tprev = next; \t\t}  \t\tDebug.DrawLine(launchPoint, targetPoint, Color.yellow, 1f); \t\tDebug.DrawLine( \t\t\t\u2026 \t\t\tColor.white, 1f \t\t);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bo\/qv\/ud\/boqvuda-fwbskvuul5tuaosc7w8.gif\"><\/div>\n<p>  <i>\u041f\u0440\u0438\u0446\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u0435.<\/i><\/p>\n<h2>\u0421\u043d\u0430\u0440\u044f\u0434\u044b<\/h2>\n<p>  \u0421\u043c\u044b\u0441\u043b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0439 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u043d\u0430\u0440\u044f\u0434\u044b. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0445 \u0438 \u0441\u0442\u0440\u0435\u043b\u044f\u0442\u044c \u0438\u043c\u0438.<\/p>\n<h3>War Factory<\/h3>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432. \u041d\u0430\u0445\u043e\u0434\u044f\u0441\u044c \u0432 \u0432\u043e\u0437\u0434\u0443\u0445\u0435, \u0441\u043d\u0430\u0440\u044f\u0434\u044b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0448\u0435\u0439 \u0438\u043c\u0438 \u043c\u043e\u0440\u0442\u0438\u0440\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u0430\u0448\u043d\u044f-\u043c\u043e\u0440\u0442\u0438\u0440\u0430, \u0438 \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0442\u0430\u0439\u043b\u043e\u0432 \u0442\u043e\u0436\u0435 \u043f\u043b\u043e\u0445\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u0438\u044f\u043c\u0438, \u043d\u043e\u0432\u0443\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0438 \u043d\u0430\u0437\u043e\u0432\u0451\u043c \u0435\u0451 war factory. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 <code>WarEntity<\/code> \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c <code>OriginFactory<\/code> \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <code>Recycle<\/code>.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public abstract class WarEntity : MonoBehaviour {  \tWarFactory originFactory;  \tpublic WarFactory OriginFactory { \t\tget =&gt; originFactory; \t\tset { \t\t\tDebug.Assert(originFactory == null, \"Redefined origin factory!\"); \t\t\toriginFactory = value; \t\t} \t}  \tpublic void Recycle () { \t\toriginFactory.Reclaim(this); \t} }<\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c <code>Shell<\/code> \u0434\u043b\u044f \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public class Shell : WarEntity { }<\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0430\u043c\u0443 <code>WarFactory<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043d\u0430\u0440\u044f\u0434 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430-\u0433\u0435\u0442\u0442\u0435\u0440\u0430.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  [CreateAssetMenu] public class WarFactory : GameObjectFactory {  \t[SerializeField] \tShell shellPrefab = default;  \tpublic Shell Shell\u20ac =&gt; Get(shellPrefab);  \tT Get&lt;T&gt; (T prefab) where T : WarEntity { \t\tT instance = CreateGameObjectInstance(prefab); \t\tinstance.OriginFactory = this; \t\treturn instance; \t}  \tpublic void Reclaim (WarEntity entity) { \t\tDebug.Assert(entity.OriginFactory == this, \"Wrong factory reclaimed!\"); \t\tDestroy(entity.gameObject); \t} }<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0435\u0444\u0430\u0431 \u0434\u043b\u044f \u0441\u043d\u0430\u0440\u044f\u0434\u0430. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u0443\u0431 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043e\u043c 0.25 \u0438 \u0442\u0451\u043c\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>Shell<\/code>. \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0430\u0441\u0441\u0435\u0442 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043c \u0435\u043c\u0443 \u043f\u0440\u0435\u0444\u0430\u0431 \u0441\u043d\u0430\u0440\u044f\u0434\u0430.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/62a\/a5e\/803\/62aa5e8031ffc282f8f54ea2084884bd.png\" width=\"320\" height=\"88\"><\/div>\n<p>  <i>War factory.<\/i><\/p>\n<h3>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0438\u0433\u0440\u0435<\/h3>\n<p>  \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u043c \u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 <code>Game<\/code> \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u0440\u0430\u0433\u043e\u0432. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u044b \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u043c, \u0441\u043e\u0437\u0434\u0430\u0432 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>GameBehavior<\/code>, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 <code>MonoBehaviour<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>GameUpdate<\/code>.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public abstract class GameBehavior : MonoBehaviour {  \tpublic virtual bool GameUpdate () =&gt; true; }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 <code>EnemyCollection<\/code>, \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0432 \u0435\u0433\u043e \u0432 <code>GameBehaviorCollection<\/code>.<\/p>\n<pre><code class=\"cs\">public class GameBehaviorCollection {  \tList&lt;GameBehavior&gt; behaviors = new List&lt;GameBehavior&gt;();  \tpublic void Add (GameBehavior behavior) { \t\tbehaviors.Add(behavior); \t}  \tpublic void GameUpdate () { \t\tfor (int i = 0; i &lt; behaviors.Count; i++) { \t\t\tif (!behaviors[i].GameUpdate()) { \t\t\t\tint lastIndex = behaviors.Count - 1; \t\t\t\tbehaviors[i] = behaviors[lastIndex]; \t\t\t\tbehaviors.RemoveAt(lastIndex); \t\t\t\ti -= 1; \t\t\t} \t\t} \t} }<\/code><\/pre>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b <code>WarEntity<\/code> \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u043b <code>GameBehavior<\/code>, \u0430 \u043d\u0435 <code>MonoBehavior<\/code>.<\/p>\n<pre><code class=\"cs\">public abstract class WarEntity : GameBehavior { \u2026 }<\/code><\/pre>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438 \u0434\u043b\u044f <code>Enemy<\/code>, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u043c\u0435\u0442\u043e\u0434 <code>GameUpdate<\/code>.<\/p>\n<pre><code class=\"cs\">public class Enemy : GameBehavior {  \t\u2026  \tpublic override bool GameUpdate () { \u2026 } \t \t\u2026 }<\/code><\/pre>\n<p>  \u0421 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 <code>Game<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0432\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u043e\u0434\u043d\u0443 \u0434\u043b\u044f \u0432\u0440\u0430\u0433\u043e\u0432, \u0434\u0440\u0443\u0433\u0443\u044e \u0434\u043b\u044f \u043d\u0435-\u0432\u0440\u0430\u0433\u043e\u0432. \u041d\u0435-\u0432\u0440\u0430\u0433\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e.<\/p>\n<pre><code class=\"cs\">\tGameBehaviorCollection enemies = new GameBehaviorCollection(); \tGameBehaviorCollection nonEnemies = new GameBehaviorCollection();  \t\u2026  \tvoid Update () { \t\t\u2026 \t\tenemies.GameUpdate(); \t\tPhysics.SyncTransforms(); \t\tboard.GameUpdate(); \t\tnonEnemies.GameUpdate(); \t}<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432 \u2014 \u044d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0445 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043d\u0435-\u0432\u0440\u0430\u0433\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0444\u0443\u043a\u043d\u0446\u0438\u0438 <code>Game<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0444\u0430\u0441\u0430\u0434\u043e\u043c \u0434\u043b\u044f war factory, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0440\u044f\u0434\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u043c <code>Game.SpawnShell()<\/code>. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, <code>Game<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 war factory \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440.<\/p>\n<pre><code class=\"cs\">\t[SerializeField] \tWarFactory warFactory = default;  \t\u2026  \tstatic Game instance;  \tpublic static Shell SpawnShell () { \t\tShell shell = instance.warFactory.Shell\u20ac; \t\tinstance.nonEnemies.Add(shell); \t\treturn shell; \t}  \tvoid OnEnable () { \t\tinstance = this; \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9fd\/b90\/878\/9fdb90878989bd89121c012671db1ce3.png\" width=\"320\" height=\"164\"><\/div>\n<p>  <i>Game \u0441 war factory.<\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0444\u0430\u0441\u0430\u0434 &#8212; \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435?<\/b><\/p>\n<div class=\"spoiler_text\">\u041e\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0433\u0434\u0435 \u0443\u0433\u043e\u0434\u043d\u043e \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432.<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u0442\u0440\u0435\u043b\u044f\u0435\u043c \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u043c<\/h3>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441\u043d\u0430\u0440\u044f\u0434\u0430 \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043b\u0435\u0442\u0435\u0442\u044c \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0446\u0435\u043b\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>Shell<\/code> \u043c\u0435\u0442\u043e\u0434 <code>Initialize<\/code> \u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0442\u043e\u0447\u043a\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430, \u0442\u043e\u0447\u043a\u0438 \u0446\u0435\u043b\u0438 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430.<\/p>\n<pre><code class=\"cs\">\tVector3 launchPoint, targetPoint, launchVelocity; \t \tpublic void Initialize ( \t\tVector3 launchPoint, Vector3 targetPoint, Vector3 launchVelocity \t) { \t\tthis.launchPoint = launchPoint; \t\tthis.targetPoint = targetPoint; \t\tthis.launchVelocity = launchVelocity; \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043d\u0430\u0440\u044f\u0434 \u0432 <code>MortarTower.Launch<\/code> \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0443\u0442\u044c.<\/p>\n<pre><code class=\"cs\">\t\tmortar.localRotation = \t\t\tQuaternion.LookRotation(new Vector3(dir.x, tanTheta, dir.y));  \t\tGame.SpawnShell().Initialize( \t\t\tlaunchPoint, targetPoint, \t\t\tnew Vector3(s * cosTheta * dir.x, s * sinTheta, s * cosTheta * dir.y) \t\t);<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0414\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0441\u043d\u0430\u0440\u044f\u0434\u0430<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b <code>Shell<\/code> \u0434\u0432\u0438\u0433\u0430\u043b\u0441\u044f, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0435\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u0435 \u0441 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430. \u0422\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 <code>GameUpdate<\/code>. \u041c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0433\u043e \u0442\u043e\u0447\u043a\u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0440\u044f\u0434 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b \u043f\u043e \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cs\">\tfloat age;  \t\u2026  \tpublic override bool GameUpdate () { \t\tage += Time.deltaTime; \t\tVector3 p = launchPoint + launchVelocity * age; \t\tp.y -= 0.5f * 9.81f * age * age; \t\ttransform.localPosition = p; \t\treturn true; \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/la\/lk\/0n\/lalk0nexu2vobomavqxtxomrcsa.gif\"><\/div>\n<p>  <i>\u0421\u0442\u0440\u0435\u043b\u044c\u0431\u0430 \u0441\u043d\u0430\u0440\u044f\u0434\u0430\u043c\u0438.<\/i><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0440\u043e\u0432\u043d\u044f\u0442\u044c \u0441\u043d\u0430\u0440\u044f\u0434\u044b \u0441 \u0438\u0445 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u043c\u0438, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u0434\u043e\u043b\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0445 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<pre><code class=\"cs\">\tpublic override bool GameUpdate () { \t\t\u2026 \t\t \t\tVector3 d = launchVelocity; \t\td.y -= 9.81f * age; \t\ttransform.localRotation = Quaternion.LookRotation(d); \t\treturn true; \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/st\/w8\/vh\/stw8vh7pqutsy8bd8ilpigmci8e.gif\"><\/div>\n<p>  <i>\u0421\u043d\u0430\u0440\u044f\u0434\u044b \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f.<\/i><\/p>\n<h3>\u041f\u043e\u0434\u0447\u0438\u0449\u0430\u0435\u043c \u0438\u0433\u0440\u0443<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0441\u043d\u0430\u0440\u044f\u0434\u044b \u043b\u0435\u0442\u044f\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u043a\u0430\u043a \u0438 \u0434\u043e\u043b\u0436\u043d\u044b, \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 <code>MortarTower.Launch<\/code> \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0439.<\/p>\n<pre><code class=\"cs\">\tpublic void Launch (TargetPoint target) { \t\t\u2026 \t\t \t\tGame.SpawnShell().Initialize( \t\t\tlaunchPoint, targetPoint, \t\t\tnew Vector3(s * cosTheta * dir.x, s * sinTheta, s * cosTheta * dir.y) \t\t);  \t}<\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0440\u044f\u0434\u044b \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u043b\u0438\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0432 \u0446\u0435\u043b\u044c. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0446\u0435\u043b\u0438\u043c\u0441\u044f \u0432 \u0437\u0435\u043c\u043b\u044e, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f \u0432 <code>Shell.GameUpdate<\/code>, \u043d\u0435 \u0441\u0442\u0430\u043b\u0430 \u043b\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u043d\u0438\u0436\u0435 \u043d\u0443\u043b\u044f. \u041c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0434\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0441\u043d\u0430\u0440\u044f\u0434\u0430.<\/p>\n<pre><code class=\"cs\">\tpublic override bool GameUpdate () { \t\tage += Time.deltaTime; \t\tVector3 p = launchPoint + launchVelocity * age; \t\tp.y -= 0.5f * 9.81f * age * age;  \t\tif (p.y &lt;= 0f) { \t\t\tOriginFactory.Reclaim(this); \t\t\treturn false; \t\t} \t\t \t\ttransform.localPosition = p; \t\t\u2026 \t}<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0414\u0435\u0442\u043e\u043d\u0430\u0446\u0438\u044f<\/h3>\n<p>  \u041c\u044b \u0441\u0442\u0440\u0435\u043b\u044f\u0435\u043c \u0441\u043d\u0430\u0440\u044f\u0434\u0430\u043c\u0438 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u043d\u0438\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432\u0437\u0440\u044b\u0432\u0447\u0430\u0442\u043a\u0430. \u041a\u043e\u0433\u0434\u0430 \u0441\u043d\u0430\u0440\u044f\u0434 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u0446\u0435\u043b\u0438, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0434\u0435\u0442\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0430\u043d\u0435\u0441\u0442\u0438 \u0443\u0440\u043e\u043d \u0432\u0441\u0435\u043c \u0432\u0440\u0430\u0433\u0430\u043c \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0437\u0440\u044b\u0432\u0430. \u0420\u0430\u0434\u0438\u0443\u0441 \u0432\u0437\u0440\u044b\u0432\u0430 \u0438 \u043d\u0430\u043d\u043e\u0441\u0438\u043c\u044b\u0439 \u0443\u0440\u043e\u043d \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0442\u0438\u043f\u0430 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0440\u0442\u0438\u0440\u043e\u0439 \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>MortarTower<\/code> \u0434\u043b\u044f \u043d\u0438\u0445 \u043e\u043f\u0446\u0438\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"cs\">\t[SerializeField, Range(0.5f, 3f)] \tfloat shellBlastRadius = 1f;  \t[SerializeField, Range(1f, 100f)] \tfloat shellDamage = 10f;<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9ad\/8e8\/731\/9ad8e87318ff5bd96472454663026a45.png\" width=\"320\" height=\"148\"><\/div>\n<p>  <i>\u0420\u0430\u0434\u0438\u0443\u0441 \u0432\u0437\u0440\u044b\u0432\u0430 \u0438 1.5 \u0443\u0440\u043e\u043d 15 \u0441\u043d\u0430\u0440\u044f\u0434\u0430.<\/i><\/p>\n<p>  \u042d\u0442\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u0430\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0437\u0440\u044b\u0432\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0451 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 <code>Shell<\/code> \u0438 \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 <code>Initialize<\/code>.<\/p>\n<pre><code class=\"cs\">\tfloat age, blastRadius, damage;  \tpublic void Initialize ( \t\tVector3 launchPoint, Vector3 targetPoint, Vector3 launchVelocity, \t\tfloat blastRadius, float damage \t) { \t\t\u2026 \t\tthis.blastRadius = blastRadius; \t\tthis.damage = damage; \t}<\/code><\/pre>\n<p>  <code>MortarTower<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043d\u0430\u0440\u044f\u0434\u0443 \u043f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cs\">\t\tGame.SpawnShell().Initialize( \t\t\tlaunchPoint, targetPoint, \t\t\tnew Vector3(s * cosTheta * dir.x, s * sinTheta, s * cosTheta * dir.y), \t\t\tshellBlastRadius, shellDamage \t\t);<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u0442\u0440\u0435\u043b\u044f\u0442\u044c \u043f\u043e \u0432\u0440\u0430\u0433\u0430\u043c \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0441\u043d\u0430\u0440\u044f\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0446\u0435\u043b\u0438. \u0423 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043d\u043e \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <code>Tower<\/code>. \u0422\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e, \u0447\u0435\u043c\u0443 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u044c, \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 <code>TargetPoint<\/code> \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0451 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u0430, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0446\u0435\u043b\u0438.<\/p>\n<pre><code class=\"cs\">\tconst int enemyLayerMask = 1 &lt;&lt; 9;  \tstatic Collider[] buffer = new Collider[100];  \tpublic static int BufferedCount { get; private set; }  \tpublic static bool FillBuffer (Vector3 position, float range) { \t\tVector3 top = position; \t\ttop.y += 3f; \t\tBufferedCount = Physics.OverlapCapsuleNonAlloc( \t\t\tposition, top, range, buffer, enemyLayerMask \t\t); \t\treturn BufferedCount &gt; 0; \t}  \tpublic static TargetPoint GetBuffered (int index) { \t\tvar target = buffer[index].GetComponent&lt;TargetPoint&gt;(); \t\tDebug.Assert(target != null, \"Targeted non-enemy!\", buffer[0]); \t\treturn target; \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 \u0446\u0435\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0443\u0444\u0435\u0440\u0430 \u0438 \u043d\u0430\u043d\u043e\u0441\u0438\u0442\u044c \u0438\u043c \u0443\u0440\u043e\u043d \u043f\u0440\u0438 \u0434\u0435\u0442\u043e\u043d\u0430\u0446\u0438\u0438 <code>Shell<\/code>.<\/p>\n<pre><code class=\"cs\">\t\tif (p.y &lt;= 0f) { \t\t\tTargetPoint.FillBuffer(targetPoint, blastRadius); \t\t\tfor (int i = 0; i &lt; TargetPoint.BufferedCount; i++) { \t\t\t\tTargetPoint.GetBuffered(i).Enemy\u20ac.ApplyDamage(damage); \t\t\t} \t\t\tOriginFactory.Reclaim(this); \t\t\treturn false; \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ft\/w4\/56\/ftw456dleh2agua1n3kipiplrdq.gif\"><\/div>\n<p>  <i>\u0414\u0435\u0442\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432.<\/i><\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a <code>TargetPoint<\/code> \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0446\u0435\u043b\u044c \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430.<\/p>\n<pre><code class=\"cs\">\tpublic static TargetPoint RandomBuffered =&gt; \t\tGetBuffered(Random.Range(0, BufferedCount));<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c <code>Tower<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0446\u0435\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>TargetPoint<\/code>.<\/p>\n<pre><code class=\"cs\"> \tprotected bool AcquireTarget (out TargetPoint target) { \t\tif (TargetPoint.FillBuffer(transform.localPosition, targetingRange)) { \t\t\ttarget = TargetPoint.RandomBuffered; \t\t\treturn true; \t\t} \t\ttarget = null; \t\treturn false; \t}<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0412\u0437\u0440\u044b\u0432\u044b<\/h3>\n<p>  \u0412\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0430\u0432\u0434\u043e\u043f\u043e\u0434\u043e\u0431\u043d\u043e. \u041c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u0443, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u0437\u0440\u044b\u0432\u0430 \u043f\u0440\u0438 \u0434\u0435\u0442\u043e\u043d\u0430\u0446\u0438\u0438 \u0441\u043d\u0430\u0440\u044f\u0434\u0430. \u042d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u043d\u043e \u0438 \u0434\u0430\u0441\u0442 \u0438\u0433\u0440\u043e\u043a\u0443 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0435\u0444\u0430\u0431 \u0432\u0437\u0440\u044b\u0432\u0430 \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u043b\u0430\u0437\u0435\u0440\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0430. \u0422\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u043e\u0439 \u044f\u0440\u043a\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u043c\u0443 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 <code>Explosion<\/code> \u0441 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0439 \u043c\u0435\u0442\u043e\u0434 <code>Initialize<\/code>, \u0437\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u0440\u0430\u0434\u0438\u0443\u0441 \u0432\u0437\u0440\u044b\u0432\u0430. \u041f\u0440\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0432\u043e\u0438\u0442\u044c \u0440\u0430\u0434\u0438\u0443\u0441, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0440\u0430\u0434\u0438\u0443\u0441 \u043c\u0435\u0448\u0430 \u0441\u0444\u0435\u0440\u044b \u0440\u0430\u0432\u0435\u043d 0.5. \u0422\u0430\u043a\u0436\u0435 \u044d\u0442\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0443\u0440\u043e\u043d\u0430 \u0432\u0441\u0435\u043c \u0432\u0440\u0430\u0433\u0430\u043c \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0434\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0451 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0443\u0440\u043e\u043d\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u043c\u0443 \u043d\u0443\u0436\u0435\u043d \u043c\u0435\u0442\u043e\u0434 <code>GameUpdate<\/code>, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439, \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u043e\u0441\u044c \u043b\u0438 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<pre><code class=\"cs\">using UnityEngine;  public class Explosion : WarEntity {  \t[SerializeField, Range(0f, 1f)] \tfloat duration = 0.5f;  \tfloat age;  \tpublic void Initialize (Vector3 position, float blastRadius, float damage) { \t\tTargetPoint.FillBuffer(position, blastRadius); \t\tfor (int i = 0; i &lt; TargetPoint.BufferedCount; i++) { \t\t\tTargetPoint.GetBuffered(i).Enemy.ApplyDamage(damage); \t\t} \t\ttransform.localPosition = position; \t\ttransform.localScale = Vector3.one * (2f * blastRadius); \t}  \tpublic override bool GameUpdate () { \t\tage += Time.deltaTime; \t\tif (age &gt;= duration) { \t\t\tOriginFactory.Reclaim(this); \t\t\treturn false; \t\t} \t\treturn true; \t} }<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0437\u0440\u044b\u0432 \u0432 <code>WarFactory<\/code>.<\/p>\n<pre><code class=\"cs\">\t[SerializeField] \tExplosion explosionPrefab = default;  \t[SerializeField] \tShell shellPrefab = default;  \tpublic Explosion Explosion\u20ac =&gt; Get(explosionPrefab);  \tpublic Shell Shell =&gt; Get(shellPrefab);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d0d\/6e6\/e49\/d0d6e6e49ff7ad3bd485705dabe02b5b.png\" width=\"320\" height=\"60\"><\/div>\n<p>  <i>War factory \u0441\u043e \u0432\u0437\u0440\u044b\u0432\u043e\u043c.<\/i><\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>Game<\/code> \u0444\u0430\u0441\u0430\u0434\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<pre><code class=\"cs\">\tpublic static Explosion SpawnExplosion () { \t\tExplosion explosion = instance.warFactory.Explosion\u20ac; \t\tinstance.nonEnemies.Add(explosion); \t\treturn explosion; \t}<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c <code>Shell<\/code> \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0442\u044c \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0437\u0440\u044b\u0432 \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u0446\u0435\u043b\u0438. \u041d\u0430\u043d\u043e\u0441\u0438\u0442\u044c \u0443\u0440\u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u0430\u043c \u0432\u0437\u0440\u044b\u0432.<\/p>\n<pre><code class=\"cs\">\t\tif (p.y &lt;= 0f) { \t\t\tGame.SpawnExplosion().Initialize(targetPoint, blastRadius, damage); \t\t\tOriginFactory.Reclaim(this); \t\t\treturn false; \t\t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zk\/q_\/rb\/zkq_rbdw8g0f3ysfxw5qw4yg47e.gif\"><\/div>\n<p>  <i>\u0412\u0437\u0440\u044b\u0432\u044b \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432.<\/i><\/p>\n<h3>\u0411\u043e\u043b\u0435\u0435 \u043f\u043b\u0430\u0432\u043d\u044b\u0435 \u0432\u0437\u0440\u044b\u0432\u044b<\/h3>\n<p>  \u041d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u0441\u0444\u0435\u0440\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u0437\u0440\u044b\u0432\u043e\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u043e. \u041c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0438\u0445, \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0432 \u043d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0444\u043e\u0440\u043c\u0443\u043b\u0443, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043a\u0440\u0438\u0432\u044b\u043c\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0449\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a <code>Explosion<\/code> \u0434\u0432\u0430 \u043f\u043e\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 <code>AnimationCurve<\/code>. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0440\u0438\u0432\u044b\u0435 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u0440\u043e\u043a\u0430 \u0436\u0438\u0437\u043d\u0438 \u0432\u0437\u0440\u044b\u0432\u0430, \u0438 \u0432\u0440\u0435\u043c\u044f 1 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u043a\u043e\u043d\u0435\u0446 \u0432\u0437\u0440\u044b\u0432\u0430, \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0435\u0433\u043e \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0443 \u0438 \u0440\u0430\u0434\u0438\u0443\u0441\u0443 \u0432\u0437\u0440\u044b\u0432\u0430. \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442 \u0438\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<pre><code class=\"cs\">\t[SerializeField] \tAnimationCurve opacityCurve = default;  \t[SerializeField] \tAnimationCurve scaleCurve = default;<\/code><\/pre>\n<p>  \u041d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0443\u043b\u0451\u043c, \u043f\u043b\u0430\u0432\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044f\u0441\u044c \u0434\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 0.3. \u041c\u0430\u0441\u0448\u0442\u0430\u0431 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 0.7, \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0430\u0442\u044c\u0441\u044f \u043a 1.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/bca\/b95\/968\/bcab95968f9d302b9c55954581d37920.png\" width=\"320\" height=\"98\"><\/div>\n<p>  <i>\u041a\u0440\u0438\u0432\u044b\u0435 \u0432\u0437\u0440\u044b\u0432\u0430.<\/i><\/p>\n<p>  \u0414\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0431\u043b\u043e\u043a\u043e\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. \u0433\u0434\u0435 \u0447\u0451\u0440\u043d\u044b\u0439 \u0446\u0432\u0435\u0442 \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f opacity. \u041c\u0430\u0441\u0448\u0442\u0430\u0431 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0432 <code>GameUpdate<\/code>, \u043d\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e\u043b\u044f \u0440\u0430\u0434\u0438\u0443\u0441. \u0412 <code>Initialize<\/code> \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0434\u0432\u043e\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u0432\u044b\u0445 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u043b\u044f \u043d\u0438\u0445 <code>Evaluate<\/code> \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u043c \u043a\u0430\u043a \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0441\u0440\u043e\u043a \u0436\u0438\u0437\u043d\u0438 \u0432\u0437\u0440\u044b\u0432\u0430, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043d\u0430 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0437\u0440\u044b\u0432\u0430.<\/p>\n<pre><code class=\"cs\">\tstatic int colorPropertyID = Shader.PropertyToID(\"_Color\");  \tstatic MaterialPropertyBlock propertyBlock; \t \t\u2026 \t \tfloat scale;  \tMeshRenderer meshRenderer;  \tvoid Awake () { \t\tmeshRenderer = GetComponent&lt;MeshRenderer&gt;(); \t\tDebug.Assert(meshRenderer != null, \"Explosion without renderer!\"); \t}  \tpublic void Initialize (Vector3 position, float blastRadius, float damage) { \t\t\u2026 \t\ttransform.localPosition = position; \t\tscale = 2f * blastRadius; \t} \t \tpublic override bool GameUpdate () { \t\t\u2026 \t\t \t\tif (propertyBlock == null) { \t\t\tpropertyBlock = new MaterialPropertyBlock(); \t\t} \t\tfloat t = age \/ duration; \t\tColor c = Color.clear; \t\tc.a = opacityCurve.Evaluate(t); \t\tpropertyBlock.SetColor(colorPropertyID, c); \t\tmeshRenderer.SetPropertyBlock(propertyBlock); \t\ttransform.localScale = Vector3.one * (scale * scaleCurve.Evaluate(t)); \t\treturn true; \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-_\/bw\/-h\/-_bw-hma2vkddbfvicdsuoc7zoa.gif\"><\/div>\n<p>  <i>\u0410\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u0437\u0440\u044b\u0432\u044b.<\/i><\/p>\n<h3>\u0421\u043d\u0430\u0440\u044f\u0434\u044b-\u0442\u0440\u0430\u0441\u0441\u0435\u0440\u044b<\/h3>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u043d\u0430\u0440\u044f\u0434\u044b \u043c\u0430\u043b\u044b \u0438 \u0438\u043c\u0435\u044e\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c. \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430, \u0442\u043e \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b. \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u0431\u043e\u043b\u0435\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0441\u043d\u0430\u0440\u044f\u0434\u0430\u043c \u044d\u0444\u0444\u0435\u043a\u0442 \u0441\u043b\u0435\u0434\u0430. \u0414\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432 \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e, \u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0440\u0430\u0441\u0441\u0435\u0440\u044b. \u0422\u0430\u043a\u0438\u0435 \u0431\u043e\u0435\u043f\u0440\u0438\u043f\u0430\u0441\u044b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0438\u0437\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0438 \u044f\u0440\u043a\u0438\u0439 \u0441\u043b\u0435\u0434, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0439 \u0438\u0445 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0432\u0438\u0434\u0438\u043c\u044b\u043c\u0438.<\/p>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u043e\u0432, \u043d\u043e \u0432\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c. \u041c\u044b \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0437\u0440\u044b\u0432\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b <code>Shell<\/code> \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0432\u0437\u0440\u044b\u0432 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u0430\u0434\u0440\u0435. \u042d\u0442\u0438 \u0432\u0437\u0440\u044b\u0432\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043d\u043e\u0441\u0438\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0445\u0432\u0430\u0442 \u0446\u0435\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0443\u0441\u0442\u043e\u0439 \u0442\u0440\u0430\u0442\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>Explosion<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u0434\u0435\u043b\u0430\u0432 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0443\u0440\u043e\u043d \u043d\u0430\u043d\u043e\u0441\u0438\u043b\u0441\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u043b\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0443\u0440\u043e\u043d\u0430 \u0432 <code>Initialize<\/code> \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c.<\/p>\n<pre><code class=\"cs\">\tpublic void Initialize ( \t\tVector3 position, float blastRadius, float damage = 0f \t) { \t\tif (damage &gt; 0f) { \t\t\tTargetPoint.FillBuffer(position, blastRadius); \t\t\tfor (int i = 0; i &lt; TargetPoint.BufferedCount; i++) { \t\t\t\tTargetPoint.GetBuffered(i).Enemy.ApplyDamage(damage); \t\t\t} \t\t} \t\ttransform.localPosition = position; \t\tradius = 2f * blastRadius; \t}<\/code><\/pre>\n<p>  \u0411\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0437\u0440\u044b\u0432 \u0432 \u043a\u043e\u043d\u0446\u0435 <code>Shell.GameUpdate<\/code> \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 0.1, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0438\u0445 \u0432 \u0441\u043d\u0430\u0440\u044f\u0434\u044b-\u0442\u0440\u0430\u0441\u0441\u0435\u0440\u044b. \u041d\u0443\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0432\u0437\u0440\u044b\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043a\u0430\u0434\u0440\u043e\u0432\u043e, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d\u0438 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043a\u0430\u0434\u0440\u043e\u0432, \u043d\u043e \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u044d\u0442\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e.<\/p>\n<pre><code class=\"cs\">\tpublic override bool GameUpdate () { \t\t\u2026 \t\t \t\tGame.SpawnExplosion().Initialize(p, 0.1f); \t\treturn true; \t}<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pb\/tc\/t-\/pbtct-hdqtadh6oirtmjrqu-6-c.gif\" alt=\"image\"><\/div>\n<p>  <i>\u0421\u043d\u0430\u0440\u044f\u0434\u044b-\u0442\u0440\u0430\u0441\u0441\u0435\u0440\u044b.<\/i><\/p>\n<p>  <a href=\"https:\/\/bitbucket.org\/catlikecodingunitytutorials\/tower-defense-04-ballistics\/\">\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430<\/a><br \/>  <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/tower-defense\/ballistics\/Ballistics.pdf\">\u0421\u0442\u0430\u0442\u044c\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PDF<\/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\/ru\/post\/461605\/\"> https:\/\/habr.com\/ru\/post\/461605\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">[<a href=\"https:\/\/habr.com\/ru\/post\/449798\/\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a>, <a href=\"https:\/\/habr.com\/ru\/post\/452756\/\">\u0432\u0442\u043e\u0440\u0430\u044f<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/post\/459070\/\">\u0442\u0440\u0435\u0442\u044c\u044f<\/a> \u0447\u0430\u0441\u0442\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430]<\/p>\n<ul>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0431\u0430\u0448\u0435\u043d.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u0448\u043d\u0438-\u043c\u043e\u0440\u0442\u0438\u0440\u044b.<\/li>\n<li>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u0431\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0439.<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a \u0432\u0437\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u043d\u0430\u0440\u044f\u0434\u043e\u0432.<\/li>\n<\/ul>\n<p>  \u042d\u0442\u043e \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u0433\u0440\u044b \u0432 \u0436\u0430\u043d\u0440\u0435 <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/tower-defense\/\">tower defense<\/a>. \u0412 \u043d\u0435\u0439 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0431\u0430\u0448\u043d\u0438-\u043c\u043e\u0440\u0442\u0438\u0440\u044b, \u0441\u0442\u0440\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u0434\u0435\u0442\u043e\u043d\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0440\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0441\u043d\u0430\u0440\u044f\u0434\u0430\u043c\u0438.<\/p>\n<p>  \u0422\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u0432 Unity 2018.4.4f1.<\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cee\/22b\/b28\/cee22bb28fd043b06a81d046b1ca6ea8.jpg\" width=\"512\" height=\"256\"><\/div>\n<p>  <i>\u0412\u0440\u0430\u0433\u0438 \u043f\u043e\u0434\u0432\u0435\u0440\u0433\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043c\u0431\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u043a\u0435.<\/i>  <\/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-292772","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292772","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=292772"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292772\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}