{"id":336265,"date":"2022-07-28T03:00:13","date_gmt":"2022-07-28T03:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336265"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336265","title":{"rendered":"<span>\u041a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0433\u0440\u0443 \u043d\u0430 Monogame, \u043d\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u0430\u043d\u0438\u0442\u0430\u0440\u043e\u0432. \u0427\u0430\u0441\u0442\u044c 3, \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u044d\u043d\u0442\u0440\u043e\u043f\u0438\u044e<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438:\u00a0<a href=\"https:\/\/habr.com\/ru\/post\/676850\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 0<\/a>,\u00a0<a href=\"https:\/\/habr.com\/ru\/post\/676998\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 1<\/a>, <a href=\"https:\/\/habr.com\/ru\/post\/677718\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c2<\/a>  <\/p>\n<p><em>4.5<\/em>\u00a0<em>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u0443\u044e<\/em><\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0430\u0440\u043a\u0430\u0441 \u0438 \u0434\u043e\u0432\u0435\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0442\u044c \u043d\u0430\u0448 \u043c\u0438\u0440, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043c, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u0432\u0435\u0434\u044c, \u0443 \u043d\u0430\u0441 \u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e), \u0430, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043b\u0435\u0433\u0447\u0435 \u0431\u044b\u043b\u043e \u043e\u0431\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u0438\u0435. <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0430\u0441\u0447\u0435\u0440\u0442\u0438\u043c \u043d\u0430\u0448 \u043c\u0438\u0440 \u043d\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b (\u0442\u0430\u0439\u043b\u044b) \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043c\u0430\u0448\u0438\u043d\u043a\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0433\u043e GameCycle \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u0434\u0430\u0434\u0438\u043c \u0435\u043c\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b 10\u04458 \u044f\u0447\u0435\u0435\u043a \u0442\u0438\u043f\u0430 char. \u0418\u0434\u0435\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u2014 \u0435\u0441\u043b\u0438 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#8216;P&#8217;, \u0442\u043e \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0435 \u0438\u0433\u0440\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u0438\u0433\u0440\u043e\u043a\u0430. \u0415\u0441\u043b\u0438 \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 (\u043a\u0440\u043e\u043c\u0435 \u0431\u0443\u043b\u0435\u0432\u043e\u0433\u043e) \u0438 \u0432\u0432\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u042f \u0440\u0430\u043d\u044c\u0448\u0435 \u0442\u0430\u043a \u0438 \u0434\u0435\u043b\u0430\u043b, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0438\u0434\u0435\u044e \u0441 \u0447\u0430\u0440\u043e\u0432\u044b\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u044b \u043d\u0430 \u043a\u0430\u043d\u0430\u043b\u0435 StandaloneCoder \u0438 \u043d\u0435 \u0437\u0430\u0431\u0440\u0430\u043b \u0441\u0435\u0431\u0435 \u2014 \u043c\u043d\u0435 \u0442\u0430\u043a \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c . \u0414\u0430\u043b\u0435\u0435 \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a\u0430 \u2014 _tileSize. \u0417\u0430\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u043b\u0438\u0441\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e. \u0417\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b \u0441\u043f\u0440\u0430\u0439\u0442 \u043c\u0430\u0448\u0438\u043d\u043a\u0438 (\u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d 77\u0445100 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u0439\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0432\u043d\u044b 100. <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Initialize \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0438\u0445 \u043f\u043e\u043a\u0430 \u0434\u0432\u0430 \u2014 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0438\u0433\u0440\u043e\u043a\u0430 \u0438 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u043d\u0435 \u0438\u0433\u0440\u043e\u043a\u0430) \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u2014 &#8216;P&#8217; \u2014 \u0438\u0433\u0440\u043e\u043a, &#8216;C&#8217; \u2014 \u0434\u0440\u0443\u0433\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u043a\u0430.<\/p>\n<pre><code class=\"cs\">\/\/&lt;......................> private int _currentId;  private char[,] _map = new char [10, 8]; private int _tileSize = 100;  public int PlayerId { get; set; } public Dictionary&lt;int, IObject> Object { get; set; }  public void Initialize() {   Objects = new Dictionary&lt;int, IObject>();   _map[5, 6] = 'P';   _map[4, 4] = 'C';   _map[6, 6] = 'C';   _currentId = 1;   bool isPlacedPlayer = false;\/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b\u0438 \u043b\u0438 \u043c\u044b \u0443\u0436\u0435 \u0438\u0433\u0440\u043e\u043a\u0430   for (int y = 0; y &lt; _map.GetLength(1); y++)     for (int x = 0; x &lt; _map.GetLength(0); x++)     {       if (_map[x, y] == 'P' &amp;&amp; !isPlacedPlayer)       {         Car player = new Car();         player.ImageId = 1;     player.Pos = new Vector2(x*_tileSize + _tileSize\/2 - 38,                                 y*_tileSize + _tileSize\/2 - 50);         player.Speed = new Vector2(0, 0);      PlayerId = _currentId;         Objects.Add(_currentId, player);         isPlacedPlayer = true;     _currentId++;       }   else if (_map[x, y] == 'C')       {         Car anotherCar = new Car();   anotherCar.Pos = new Vector2(x*_tileSize + _tileSize\/2 - 38,                                 y*_tileSize + _tileSize\/2 - 50);     anotherCar.ImageId = 1;     anotherCar.Speed = new Vector2(0, 0);   Objects.Add(_currentId, anotherCar);   _currentId++;       }        }        }<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u0432\u043c\u0435\u0441\u0442\u043e \u0436\u0435\u0441\u0442\u043a\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u0440\u0442\u0435 _map, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0430\u0439\u043b\u0430. \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u044f \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u043b\u0430\u0441\u044c \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0442\u0430\u0439\u043b\u0430: \u043c\u044b \u0441\u043c\u0435\u0449\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u0442\u0430\u0439\u043b\u0430 \u043b\u0435\u0432\u044b\u0439 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0443\u0433\u043e\u043b \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u043e X \u0438 Y \u2014 \u0442\u043e\u0433\u0434\u0430 \u043b\u0435\u0432\u044b\u0439 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0443\u0433\u043e\u043b \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0446\u0435\u043d\u0442\u0440\u0435 \u0442\u0430\u0439\u043b\u0430. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043c\u0435\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u0443\u0436\u0435 \u0432\u0432\u0435\u0440\u0445 \u0438 \u0432\u043b\u0435\u0432\u043e \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u043c\u0430\u0448\u0438\u043d\u043a\u0438.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e isPlacedPlayer, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c \u0437\u0430\u043c\u0435\u0442\u0435\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u044b\u0439 \u0434\u0443\u0431\u043b\u044f\u0436 \u043a\u043e\u0434\u0430, \u043d\u043e \u043f\u043e\u043a\u0430 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u2014 \u043c\u044b \u0432\u0441\u0435 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043c.<\/em><\/p>\n<p>\u041f\u043e\u043a\u0430 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 (4;4) \u0438 (6;4) \u043c\u0430\u0448\u0438\u043d\u043a\u0438 NPC, \u0430 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 (5;6) \u2014 \u0438\u0433\u0440\u043e\u043a\u0430. \u0412\u0441\u0435\u0433\u043e \u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 10\u04458 \u043f\u0440\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0442\u0430\u0439\u043b\u0430 100 \u2014 \u0442\u043e \u0435\u0441\u0442\u044c, \u043d\u0430\u0448\u0430 \u043a\u0430\u0440\u0442\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0440\u0430\u043d, \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0438\u0433\u0440\u043e\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0438 \u0441\u043d\u0438\u0437\u0443, \u0430 NPC \u2014 \u043d\u0430 100 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0432\u044b\u0448\u0435 \u0441\u043b\u0435\u0432\u0430 \u0438 \u0441\u043f\u0440\u0430\u0432\u0430. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/cb6\/f1a\/a92\/cb6f1aa920818b54f8b2f01abafe4884.jpeg\" alt=\"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0435\u0445 \u043c\u0430\u0448\u0438\u043d\u043e\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u0430\u0440\u0442\u0435\" title=\"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0435\u0445 \u043c\u0430\u0448\u0438\u043d\u043e\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u0430\u0440\u0442\u0435\" width=\"974\" height=\"767\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cb6\/f1a\/a92\/cb6f1aa920818b54f8b2f01abafe4884.jpeg\" data-blurred=\"true\"\/><figcaption>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0435\u0445 \u043c\u0430\u0448\u0438\u043d\u043e\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u0430\u0440\u0442\u0435<\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0432 \u044d\u0442\u043e\u0439 \u0438\u0433\u0440\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043c\u0438\u043c\u043e \u043c\u0430\u0448\u0438\u043d\u043e\u043a \u2014 \u0441\u0442\u0435\u043d\u043a\u0438 \u0442\u0440\u0430\u0441\u0441\u044b. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 Wall, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IObject, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b: <\/p>\n<pre><code class=\"cs\">class Wall : IObject { public int ImageId { get; set; }   public Vector2 Pos { get; set; }      public void Update()   {      } }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u2014 \u0443 \u0441\u0442\u0435\u043d\u043a\u0438 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e, \u043a\u0440\u043e\u043c\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u2014 \u043f\u043e\u043a\u0430 \u0443 \u043d\u0435\u0435 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0430\u043f\u0434\u0435\u0439\u0442\u0430 \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043a\u043e\u0434 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u0442\u0435\u043d\u043a\u0438, \u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0435\u0435 \u043a\u0430\u043a &#8216;W&#8217;:<\/p>\n<pre><code class=\"cs\">public void Initialize() {   Objects = new Dictionary&lt;int, IObject>();   _map[5, 6] = 'P';   _map[4, 4] = 'C';   _map[6, 6] = 'C';   \/\/\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0435\u043d\u043a\u0438 \u043f\u043e \u043a\u0440\u0430\u044f\u043c \u0442\u0440\u0430\u0441\u0441\u044b   for (int y = 0; y &lt; _map.GetLength(1); y++)   {     _map[0, y] ='W';     _map[_map.GetLength(0)-1, y] ='W';   }   _currentId = 1;   bool isPlacedPlayer = false;   for (int y = 0; y &lt; _map.GetLength(1); y++)     for (int x = 0; x &lt; _map.GetLength(0); x++)     {       \/\/\u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u043c \u0437\u043d\u0430\u043a\u043e\u043c \u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430,        \/\/\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0441\u044f       \/\/&lt;........................>       else if (_map[x, y] == 'W')       {         Wall w = new Wall();         w.Pos = new Vector2(x*_tileSize + _tileSize\/2 - 12,                                 y*_tileSize + _tileSize\/2 - 50);         w.ImageId = 2;         Objects.Add(_currentId, w);         _currentId++;       }      }   }<\/code><\/pre>\n<p>\u0421\u043f\u0440\u0430\u0439\u0442 \u0434\u043b\u044f \u0441\u0442\u0435\u043d\u043a\u0438 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438 \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u2014 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443. <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/521\/017\/310\/521017310132fdbce346d01a87c2e0be.gif\" width=\"390\" height=\"306\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/521\/017\/310\/521017310132fdbce346d01a87c2e0be.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0431\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u0443\u044e \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0443 \u043c\u043e\u0435\u0433\u043e \u0434\u0435\u0442\u0441\u0442\u0432\u0430:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/b71\/b7d\/4c8\/b71b7d4c890ca7529c104828a22dc014.jpeg\" alt=\"\u0411\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0430 \u043c\u043e\u0435\u0433\u043e \u0434\u0435\u0442\u0441\u0442\u0432\u0430\" title=\"\u0411\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0430 \u043c\u043e\u0435\u0433\u043e \u0434\u0435\u0442\u0441\u0442\u0432\u0430\" width=\"303\" height=\"478\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b71\/b7d\/4c8\/b71b7d4c890ca7529c104828a22dc014.jpeg\" data-blurred=\"true\"\/><figcaption>\u0411\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0430 \u043c\u043e\u0435\u0433\u043e \u0434\u0435\u0442\u0441\u0442\u0432\u0430<\/figcaption><\/figure>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f \u0432\u043e\u0442, \u043e \u0447\u0435\u043c: \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0430\u043c\u0435\u0440\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043c\u0430\u0448\u0438\u043d\u043a\u043e\u0439, \u043d\u043e \u0438\u0433\u0440\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0439. \u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. \u0423\u0441\u0442\u0440\u0430\u043d\u0438\u043c \u044d\u0442\u043e \u0434\u043e\u0441\u0430\u0434\u043d\u043e\u0435 \u043d\u0435\u0434\u043e\u0440\u0430\u0437\u0443\u043c\u0435\u043d\u0438\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Initialize \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Updated \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Update:<\/p>\n<pre><code class=\"cs\">Updated.Invoke(this, new GameplayEventArgs() {     Objects = Objects,     POVShift = Objects[PlayerId].Pos     });<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/5c7\/586\/95e\/5c758695e08799b304b4b8122a949b5e.jpeg\" width=\"788\" height=\"688\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5c7\/586\/95e\/5c758695e08799b304b4b8122a949b5e.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u043d\u043e \u043d\u0435 \u0442\u0443\u0434\u0430, \u043a\u0443\u0434\u0430 \u043d\u0430\u0434\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 POVShift \u0440\u0430\u0432\u043d\u044b\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0435 \u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0433\u043b\u0430 \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u043c\u0430\u0448\u0438\u043d\u043a\u0438. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0437 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e POVShift \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f X \u0438 Y \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435, \u0442\u043e \u0435\u0441\u0442\u044c, \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u044d\u043a\u0440\u0430\u043d\u0430:<\/p>\n<pre><code class=\"cs\">Updated.Invoke(this, new GameplayEventArgs() {     Objects = Objects,     POVShift = new Vector2(       Objects[PlayerId].Pos.X - 512 + 38,       Objects[PlayerId].Pos.Y - 512 + 50) });<\/code><\/pre>\n<p>\u042f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0435\u0435 \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u043f\u043e \u043e\u0441\u0438 OX \u0438 \u0441\u043c\u0435\u0441\u0442\u0438\u043b \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 512 \u043f\u043e OY \u0432\u043d\u0438\u0437, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0432 \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u043a\u0440\u0430\u043d\u0430:<\/p>\n<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/433\/da6\/f6b\/433da6f6b356edf8eb4db853ee0ca55e.jpeg\" width=\"807\" height=\"639\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/433\/da6\/f6b\/433da6f6b356edf8eb4db853ee0ca55e.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043a\u0440\u0438\u0432\u043e \u043e\u0442\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0442\u0440\u0430\u0441\u0441\u0430 \u2014 \u0435\u0441\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u0438 \u043a\u0440\u0430\u044f \u044d\u043a\u0440\u0430\u043d\u0430, \u0442\u043e \u043e\u043d\u0430 \u0440\u043e\u0432\u043d\u043e \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0440\u0430\u0441\u0441\u0443 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u043d\u043e\u0439 \u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u0432 \u0435\u0435 \u043d\u0430\u0447\u0430\u043b\u0435 (\u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0438\u0437\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0441\u044c OY \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043d\u0438\u0437):  <\/p>\n<pre><code class=\"cs\">\/\/&lt;.......................> \/\/\u0414\u043b\u0438\u043d\u0430 \u0442\u0440\u0430\u0441\u0441\u044b \u0442\u0435\u043f\u0435\u0440\u044c 500 \u0442\u0430\u0439\u043b\u043e\u0432 private char[,] _map = new char [10, 500]; private int _tileSize = 100;  public int PlayerId { get; set; } public Dictionary&lt;int, IObject> Object { get; set; }  public void Initialize() {   Objects = new Dictionary&lt;int, IObject>();   _map[5, 498] = 'P'; \/\/\u041f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0442\u0440\u0430\u0441\u0441\u044b   _map[4, 4] = 'C';   _map[6, 6] = 'C';   _currentId = 1;   bool isPlacedPlayer = false;   \/\/&lt;.......................>   }<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f40\/519\/b6b\/f40519b6b5abf86f12c9625454e3a79a.gif\" width=\"390\" height=\"306\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f40\/519\/b6b\/f40519b6b5abf86f12c9625454e3a79a.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435\u043c. \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0448 \u043c\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432\u043f\u0435\u0440\u0435\u0434-\u043d\u0430\u0437\u0430\u0434, \u043d\u043e \u043d\u0430 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430\u0445 \u043c\u0430\u0448\u0438\u043d\u0443 \u0437\u0430\u043d\u043e\u0441\u0438\u0442, \u0434\u0430 \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u043f\u0440\u043e\u043f\u0438\u0448\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043b\u0430 \u0431\u043e\u043a\u043e\u0432\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f: <\/p>\n<pre><code class=\"cs\">public class Car : IObject {   public int ImageId { get; set; }     public Vector2 Pos { get; set; }      public void Update()     {         Pos += Speed;         Speed = new Vector2(0, Speed.Y);             } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0448 \u0432\u043b\u0435\u0432\u043e-\u0432\u043f\u0440\u0430\u0432\u043e \u0431\u043e\u043a\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u043d\u0430 1, \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0441\u0434\u0432\u0438\u043d\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 Update, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e, 1 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u043c\u0430\u043b\u043e\u0432\u0430\u0442\u043e, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0437\u043a\u0438\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 GameCycle \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 MovePlayer:<\/p>\n<pre><code class=\"cs\">case IGameplayModel.Direction.right: {     p.Speed += new Vector2(5, 0);     break; } case IGameplayModel.Direction.left: {     p.Speed += new Vector2(-5, 0);     break; }<\/code><\/pre>\n<p>\u0423\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0447\u0442\u043e \u043e\u0441\u044f\u0437\u0430\u0435\u043c\u043e\u0435, \u043d\u043e \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u0434 \u0432 \u043f\u043e\u0440\u044f\u0434\u043e\u043a.<\/p>\n<p><em>\u041c\u0438\u043d\u0443\u0442\u043a\u0430 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430<\/em><\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u0440\u0430\u0437\u0440\u043e\u0441\u0448\u0438\u0439\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u2014 Initalized \u0432 \u041c\u043e\u0434\u0435\u043b\u0438. \u0412 \u043d\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0440\u0430\u0442\u0438\u043c\u043e\u0439 \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u0437\u043e\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439, \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u044b \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u041c\u043e\u0434\u0435\u043b\u0438 \u2014 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0422\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 (<strong><em>\u0441\u043f\u043e\u0439\u043b\u0435\u0440<\/em><\/strong>: \u043f\u043e\u0442\u043e\u043c \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043d\u043e \u043f\u043e\u043a\u0430 \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438).  <\/p>\n<pre><code class=\"cs\">private Car CreateCar (   float x, float y, int spriteId, Vector2 speed) {   Car c = new Car();   c.ImageId = spriteId;   c.Pos = new Vector2(x, y);   c.Speed = speed;   return c; }  private Wall CreateWall(   float x, float y, int spriteId) {   Wall w = new Wall();   w.Pos = new Vector2(x, y);   w.ImageId = spriteId;   return w; }<\/code><\/pre>\n<p>\u0417\u0430\u043e\u0434\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043e\u0442 \u0434\u0443\u0431\u043b\u044f\u0436\u0430 &#8212; \u0438\u0433\u0440\u043e\u043a \u0438 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c. \u0412\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u0432 Initialize, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 GenerateObject:<\/p>\n<pre><code class=\"cs\">private IObject GenerateObject (   char sign, int xTile, int yTile) {   float x = xTile*_tileSize;   float y = yTile*_tileSize;   IObject generatedObject = null;   if (sign == 'P'|| sign == 'C')   {     generatedObject = CreateCar(       x + _tileSize\/2 - 38, y + _tileSize\/2 - 50,     spriteId: 1, speed: new Vector2(0,0));   }   else if (sign == 'W')   {     generatedObject = CreateWall(       x + _tileSize\/2 - 12, y + _tileSize\/2 - 50,     spriteId: 2);   }   return generatedObject; }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 Initialize, \u0438 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442:<\/p>\n<pre><code class=\"cs\">\/\/&lt;.....................> _currentId = 1; bool isPlacedPlayer = false; for (int y = 0; y &lt; _map.GetLength(1); y++)     for (int x = 0; x &lt; _map.GetLength(0); x++)     {       if (_map[x, y] != '\\0')       {         IObject generatedObject = GenerateObject(           _map[x, y], x, y);         Objects.Add(_currentId, generatedObject);         _currentId++;       }      } PlayerId = 1; Updated.Invoke(this, new GameplayEventArgs() {     Objects = Objects,     POVShift = new Vector2(       Objects[PlayerId].Pos.X - 512 + 38,       Objects[PlayerId].Pos.Y - 512 + 50) }); \/\/&lt;.....................><\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0430\u0439\u0434\u0438\u0448\u043d\u0438\u043a\u043e\u043c \u0438\u0433\u0440\u043e\u043a\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0432\u0435\u043d 1. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0439\u0434\u0438\u0448\u043d\u0438\u043a \u0443 \u043d\u0430\u0441 \u0441\u0442\u0435\u043d\u043a\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/fdd\/8c0\/b5c\/fdd8c0b5c469197c928f2349144d0959.jpeg\" alt=\"\u041d\u043e\u0432\u044b\u0439 \u0441\u043f\u0440\u0430\u0439\u0442 \u0438\u0433\u0440\u043e\u043a\u0430\" title=\"\u041d\u043e\u0432\u044b\u0439 \u0441\u043f\u0440\u0430\u0439\u0442 \u0438\u0433\u0440\u043e\u043a\u0430\" width=\"663\" height=\"609\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fdd\/8c0\/b5c\/fdd8c0b5c469197c928f2349144d0959.jpeg\" data-blurred=\"true\"\/><figcaption>\u041d\u043e\u0432\u044b\u0439 \u0441\u043f\u0440\u0430\u0439\u0442 \u0438\u0433\u0440\u043e\u043a\u0430<\/figcaption><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430. \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u0445\u0443\u0436\u0435, \u043d\u043e \u043f\u043e\u043a\u0430 \u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b:<\/p>\n<pre><code class=\"cs\">\/\/&lt;.....................> _currentId = 1; bool isPlacedPlayer = false; for (int y = 0; y &lt; _map.GetLength(1); y++)     for (int x = 0; x &lt; _map.GetLength(0); x++)     {       if (_map[x, y] != '\\0')       {         IObject generatedObject = GenerateObject(           _map[x, y], x, y);         if (_map[x, y] == 'P'&amp;&amp;!isPlacedPlayer)         {           PlayerId = _currentId;           isPlacedPlayer = true;         }                 Objects.Add(_currentId, generatedObject);         _currentId++;       }      } \/\/\u0421\u0442\u0440\u043e\u043a\u0443 \u0441 PlayerId = 1 \u0443\u0431\u0440\u0430\u043b\u0438 Updated.Invoke(this, new GameplayEventArgs() {     Objects = Objects,     POVShift = new Vector2(       Objects[PlayerId].Pos.X - 512 + 38,       Objects[PlayerId].Pos.Y - 512 + 50) }); \/\/&lt;.....................><\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0430\u0439\u0434\u0438\u0448\u043d\u0438\u043a\u0430\u043c \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432, \u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044e \u044d\u043a\u0440\u0430\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0436\u0435\u043d\u044b.<\/p>\n<p>\u042f \u0434\u043e\u043b\u0433\u043e (\u043c\u0438\u043d\u0443\u0442\u044b 3) \u0434\u0443\u043c\u0430\u043b \u043d\u0430\u0434 \u044d\u0442\u0438\u043c, \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u044f\u043b, \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044e, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u2014 \u0430 \u0437\u0430\u0447\u0435\u043c? \u041f\u0443\u0441\u0442\u044c \u044d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f View! \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u043e \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u0432\u043e View. \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u0442\u0430\u0439\u043b\u0443, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u0438 \u043e\u0442 \u043d\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f:<\/p>\n<pre><code class=\"cs\">\/\/&lt;.....................> \/\/\u041a\u0443\u0441\u043e\u043a \u043c\u0435\u0442\u043e\u0434\u0430 Update \u041c\u043e\u0434\u0435\u043b\u0438 Updated.Invoke(this, new GameplayEventArgs() {   \/\/\u0423\u0431\u0440\u0430\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435     Objects = Objects,     POVShift = new Vector2(       Objects[PlayerId].Pos.X,       Objects[PlayerId].Pos.Y) }); private IObject GenerateObject (   char sign, int xTile, int yTile) {   float x = xTile*_tileSize;   float y = yTile*_tileSize;   IObject generatedObject = null;   \/\/\u0423\u0431\u0440\u0430\u043b\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0441\u043f\u0440\u0430\u0439\u0442\u0430   if (sign == 'P'|| sign == 'C')   {     generatedObject = CreateCar(       x + _tileSize\/2, y + _tileSize\/2,     spriteId: 1, speed: new Vector2(0,0));   }   else if (sign == 'W')   {     generatedObject = CreateWall(       x + _tileSize\/2, y + _tileSize\/2,     spriteId: 2);   }   return generatedObject; }<\/code><\/pre>\n<p>POVShift \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043a\u043e\u043e\u0434\u0438\u043d\u0430\u0442\u044b \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u0433\u0440\u043e\u043a\u0430, \u0430 \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u043a \u0446\u0435\u043d\u0442\u0440\u0443 \u0442\u0430\u0439\u043b\u0430. \u0423\u0447\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u0438\u0448\u0435\u043c \u0432\u043e View \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"cs\">protected override void Initalize() {   base.Initialize();   _graphics.IsFullScreen = false;   _graphics.PreferredBackBufferWidth = 1024;   _graphics.PreferredBackBufferHeight = 768;   _graphics.ApplyChanges();   _visualShift.X -= _graphics.PreferredBackBufferWidth\/2;   _visualShift.Y -= _graphics.PreferredBackBufferHeight*0.8f; }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u043a\u0430\u043c\u0435\u0440\u044b \u043c\u044b \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u0432\u0438\u0434\u0438\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u2013 \u043f\u043e\u0442\u043e\u043c \u0441\u044e\u0434\u0430 \u043f\u0440\u0438\u0431\u0430\u0432\u044f\u0442\u0441\u044f \u0443\u0436\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0438\u0433\u0440\u043e\u043a\u0430 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435. \u0414\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u0438 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043c\u0435\u0449\u0430\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u2013 \u0440\u0430\u0441\u0447\u0435\u0442 \u0438\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.  <\/p>\n<p><em>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439: \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0446\u0435\u043d\u0442\u0440\u0430 \u0441\u043f\u0440\u0430\u0439\u0442\u0430 (\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0430 38, 12 \u0438 50 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0443 \u0441\u0442\u0435\u043d\u043a\u0438 \u0438 \u043c\u0430\u0448\u0438\u043d\u043a\u0438) \u044f \u0443\u0431\u0440\u0430\u043b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0433\u043b\u0430 \u0441\u043f\u0440\u0430\u0439\u0442\u0430. \u041a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e, \u0442\u043e \u044d\u0442\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0431\u044b\u043b\u0430, \u043d\u043e \u0437\u0430\u0442\u0435\u043c \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u0441\u044f, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u043b\u0441\u044f \u043e\u0434\u0438\u043d \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0431\u0430\u0433, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0440\u0438\u0432\u043e \u043e\u0431\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. \u041a\u043e\u0434 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d (\u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c \u0441\u043f\u0440\u0430\u0439\u0442\u0430\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u044b\u0431\u0440\u043e\u0448\u0435\u043d\u044b), \u043d\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430\u0445 \u0438 \u0433\u0438\u0444\u043a\u0430\u0445 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435 \u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u0431\u0430\u0433 \u044f \u0435\u0449\u0435 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 \u043c\u043d\u043e\u0439 \u043a\u043e\u0434, \u0442\u043e \u0443 \u0432\u0430\u0441 \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u043e \u0432\u043f\u0440\u0430\u0432\u043e \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0448\u0438\u0440\u0438\u043d\u044b \u043c\u0430\u0448\u0438\u043d\u043a\u0438.<\/em>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u0441 \u0430\u0439\u0434\u0438\u0448\u043d\u0438\u043a\u0430\u043c\u0438 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0432 \u043c\u043e\u0434\u0435\u043b\u0438. \u042f \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u043b \u0438 \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u0432 \u043a\u043b\u0430\u0441\u0441 GameCycle: <\/p>\n<pre><code class=\"cs\">public enum ObjectTypes : byte {     car,     wall,   }<\/code><\/pre>\n<p>\u042f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0438\u043c \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0439 \u0442\u0438\u043f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 256 \u043d\u043e\u043c\u0435\u0440\u043e\u0432, \u043d\u043e \u043d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e. \u0412\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0430\u0448\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 GenerateObject \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u0438 \u0441\u0442\u0435\u043d\u043a\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/2b9\/f0d\/d77\/2b9f0dd77b6ea37a23daedd2f4fc60db.jpeg\" width=\"974\" height=\"552\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2b9\/f0d\/d77\/2b9f0dd77b6ea37a23daedd2f4fc60db.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u2014 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a \u043b\u0435\u0433\u0447\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c.<\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b View \u043e\u0431\u0440\u0430\u0449\u0430\u043b\u0441\u044f \u043a \u0442\u0435\u043c \u0436\u0435 \u043d\u043e\u043c\u0435\u0440\u0430\u043c:<\/p>\n<pre><code class=\"cs\">protected override void LoadContent() {     _spriteBatch = new SpriteBatch(GraphicsDevice);     _textures.Add((byte)GameCycle.ObjectTypes.car, Content.Load&lt;Texture2D>(\"Base_car\"));     _textures.Add((byte)GameCycle.ObjectTypes.wall, Content.Load&lt;Texture2D>(\"Wall\")); }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d MVP, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c View \u0437\u043d\u0430\u0435\u0442 \u043e \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u043e, \u044f \u0434\u0443\u043c\u0430\u044e, \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441\u0442\u0440\u0430\u0448\u043d\u043e. View \u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0441 \u0434\u0440\u0443\u0433\u0438\u043c View &#8212; \u0432\u043f\u043e\u043b\u043d\u0435. \u041d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u0443\u044e \u043c\u0438\u043d\u0443\u0442\u043a\u0443 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u2014 \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0430\u0448\u0438 \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u0438 \u0441\u0442\u0435\u043d\u043a\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438!  <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><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\/679456\/\"> https:\/\/habr.com\/ru\/post\/679456\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438:\u00a0<a href=\"https:\/\/habr.com\/ru\/post\/676850\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 0<\/a>,\u00a0<a href=\"https:\/\/habr.com\/ru\/post\/676998\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 1<\/a>, <a href=\"https:\/\/habr.com\/ru\/post\/677718\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c2<\/a>  <\/p>\n<p><em>4.5<\/em>\u00a0<em>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u0443\u044e<\/em><\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0430\u0440\u043a\u0430\u0441 \u0438 \u0434\u043e\u0432\u0435\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0442\u044c \u043d\u0430\u0448 \u043c\u0438\u0440, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043c, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u0432\u0435\u0434\u044c, \u0443 \u043d\u0430\u0441 \u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e), \u0430, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043b\u0435\u0433\u0447\u0435 \u0431\u044b\u043b\u043e \u043e\u0431\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u0438\u0435. <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0430\u0441\u0447\u0435\u0440\u0442\u0438\u043c \u043d\u0430\u0448 \u043c\u0438\u0440 \u043d\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b (\u0442\u0430\u0439\u043b\u044b) \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043c\u0430\u0448\u0438\u043d\u043a\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0433\u043e GameCycle \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u0434\u0430\u0434\u0438\u043c \u0435\u043c\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b 10\u04458 \u044f\u0447\u0435\u0435\u043a \u0442\u0438\u043f\u0430 char. \u0418\u0434\u0435\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u2014 \u0435\u0441\u043b\u0438 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#8216;P&#8217;, \u0442\u043e \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0435 \u0438\u0433\u0440\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u0438\u0433\u0440\u043e\u043a\u0430. \u0415\u0441\u043b\u0438 \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 (\u043a\u0440\u043e\u043c\u0435 \u0431\u0443\u043b\u0435\u0432\u043e\u0433\u043e) \u0438 \u0432\u0432\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u042f \u0440\u0430\u043d\u044c\u0448\u0435 \u0442\u0430\u043a \u0438 \u0434\u0435\u043b\u0430\u043b, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0438\u0434\u0435\u044e \u0441 \u0447\u0430\u0440\u043e\u0432\u044b\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u044b \u043d\u0430 \u043a\u0430\u043d\u0430\u043b\u0435 StandaloneCoder \u0438 \u043d\u0435 \u0437\u0430\u0431\u0440\u0430\u043b \u0441\u0435\u0431\u0435 \u2014 \u043c\u043d\u0435 \u0442\u0430\u043a \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c . \u0414\u0430\u043b\u0435\u0435 \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a\u0430 \u2014 _tileSize. \u0417\u0430\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u043b\u0438\u0441\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e. \u0417\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b \u0441\u043f\u0440\u0430\u0439\u0442 \u043c\u0430\u0448\u0438\u043d\u043a\u0438 (\u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d 77\u0445100 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u0439\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0432\u043d\u044b 100. <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Initialize \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0438\u0445 \u043f\u043e\u043a\u0430 \u0434\u0432\u0430 \u2014 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0438\u0433\u0440\u043e\u043a\u0430 \u0438 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u043d\u0435 \u0438\u0433\u0440\u043e\u043a\u0430) \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u2014 &#8216;P&#8217; \u2014 \u0438\u0433\u0440\u043e\u043a, &#8216;C&#8217; \u2014 \u0434\u0440\u0443\u0433\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u043a\u0430.<\/p>\n<pre><code class=\"cs\">\/\/&lt;......................> private int _currentId;  private char[,] _map = new char [10, 8]; private int _tileSize = 100;  public int PlayerId { get; set; } public Dictionary&lt;int, IObject> Object { get; set; }  public void Initialize() {   Objects = new Dictionary&lt;int, IObject>();   _map[5, 6] = 'P';   _map[4, 4] = 'C';   _map[6, 6] = 'C';   _currentId = 1;   bool isPlacedPlayer = false;\/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b\u0438 \u043b\u0438 \u043c\u044b \u0443\u0436\u0435 \u0438\u0433\u0440\u043e\u043a\u0430   for (int y = 0; y &lt; _map.GetLength(1); y++)     for (int x = 0; x &lt; _map.GetLength(0); x++)     {       if (_map[x, y] == 'P' &amp;&amp; !isPlacedPlayer)       {         Car player = new Car();         player.ImageId = 1;     player.Pos = new Vector2(x*_tileSize + _tileSize\/2 - 38,                                 y*_tileSize + _tileSize\/2 - 50);         player.Speed = new Vector2(0, 0);      PlayerId = _currentId;         Objects.Add(_currentId, player);         isPlacedPlayer = true;     _currentId++;       }   else if (_map[x, y] == 'C')       {         Car anotherCar = new Car();   anotherCar.Pos = new Vector2(x*_tileSize + _tileSize\/2 - 38,                                 y*_tileSize + _tileSize\/2 - 50);     anotherCar.ImageId = 1;     anotherCar.Speed = new Vector2(0, 0);   Objects.Add(_currentId, anotherCar);   _currentId++;       }        }        }<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u0432\u043c\u0435\u0441\u0442\u043e \u0436\u0435\u0441\u0442\u043a\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u0440\u0442\u0435 _map, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0430\u0439\u043b\u0430. \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u044f \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u043b\u0430\u0441\u044c \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0442\u0430\u0439\u043b\u0430: \u043c\u044b \u0441\u043c\u0435\u0449\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u0442\u0430\u0439\u043b\u0430 \u043b\u0435\u0432\u044b\u0439 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0443\u0433\u043e\u043b \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u043e X \u0438 Y \u2014 \u0442\u043e\u0433\u0434\u0430 \u043b\u0435\u0432\u044b\u0439 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0443\u0433\u043e\u043b \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0446\u0435\u043d\u0442\u0440\u0435 \u0442\u0430\u0439\u043b\u0430. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043c\u0435\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u0443\u0436\u0435 \u0432\u0432\u0435\u0440\u0445 \u0438 \u0432\u043b\u0435\u0432\u043e \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u043c\u0430\u0448\u0438\u043d\u043a\u0438.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e isPlacedPlayer, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c \u0437\u0430\u043c\u0435\u0442\u0435\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u044b\u0439 \u0434\u0443\u0431\u043b\u044f\u0436 \u043a\u043e\u0434\u0430, \u043d\u043e \u043f\u043e\u043a\u0430 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u2014 \u043c\u044b \u0432\u0441\u0435 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043c.<\/em><\/p>\n<p>\u041f\u043e\u043a\u0430 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 (4;4) \u0438 (6;4) \u043c\u0430\u0448\u0438\u043d\u043a\u0438 NPC, \u0430 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 (5;6) \u2014 \u0438\u0433\u0440\u043e\u043a\u0430. \u0412\u0441\u0435\u0433\u043e \u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 10\u04458 \u043f\u0440\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0442\u0430\u0439\u043b\u0430 100 \u2014 \u0442\u043e \u0435\u0441\u0442\u044c, \u043d\u0430\u0448\u0430 \u043a\u0430\u0440\u0442\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0440\u0430\u043d, \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0438\u0433\u0440\u043e\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0438 \u0441\u043d\u0438\u0437\u0443, \u0430 NPC \u2014 \u043d\u0430 100 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0432\u044b\u0448\u0435 \u0441\u043b\u0435\u0432\u0430 \u0438 \u0441\u043f\u0440\u0430\u0432\u0430. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c.<\/p>\n<figure class=\"full-width\"><figcaption>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0435\u0445 \u043c\u0430\u0448\u0438\u043d\u043e\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u0430\u0440\u0442\u0435<\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0432 \u044d\u0442\u043e\u0439 \u0438\u0433\u0440\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043c\u0438\u043c\u043e \u043c\u0430\u0448\u0438\u043d\u043e\u043a \u2014 \u0441\u0442\u0435\u043d\u043a\u0438 \u0442\u0440\u0430\u0441\u0441\u044b. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 Wall, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IObject, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b: <\/p>\n<pre><code class=\"cs\">class Wall : IObject { public int ImageId { get; set; }   public Vector2 Pos { get; set; }      public void Update()   {      } }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u2014 \u0443 \u0441\u0442\u0435\u043d\u043a\u0438 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e, \u043a\u0440\u043e\u043c\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u2014 \u043f\u043e\u043a\u0430 \u0443 \u043d\u0435\u0435 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0430\u043f\u0434\u0435\u0439\u0442\u0430 \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043a\u043e\u0434 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u0442\u0435\u043d\u043a\u0438, \u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0435\u0435 \u043a\u0430\u043a &#8216;W&#8217;:<\/p>\n<pre><code class=\"cs\">public void Initialize() {   Objects = new Dictionary&lt;int, IObject>();   _map[5, 6] = 'P';   _map[4, 4] = 'C';   _map[6, 6] = 'C';   \/\/\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0435\u043d\u043a\u0438 \u043f\u043e \u043a\u0440\u0430\u044f\u043c \u0442\u0440\u0430\u0441\u0441\u044b   for (int y = 0; y &lt; _map.GetLength(1); y++)   {     _map[0, y] ='W';     _map[_map.GetLength(0)-1, y] ='W';   }   _currentId = 1;   bool isPlacedPlayer = false;   for (int y = 0; y &lt; _map.GetLength(1); y++)     for (int x = 0; x &lt; _map.GetLength(0); x++)     {       \/\/\u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u043c \u0437\u043d\u0430\u043a\u043e\u043c \u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430,        \/\/\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0441\u044f       \/\/&lt;........................>       else if (_map[x, y] == 'W')       {         Wall w = new Wall();         w.Pos = new Vector2(x*_tileSize + _tileSize\/2 - 12,                                 y*_tileSize + _tileSize\/2 - 50);         w.ImageId = 2;         Objects.Add(_currentId, w);         _currentId++;       }      }   }<\/code><\/pre>\n<p>\u0421\u043f\u0440\u0430\u0439\u0442 \u0434\u043b\u044f \u0441\u0442\u0435\u043d\u043a\u0438 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438 \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u2014 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443. <\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0431\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u0443\u044e \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0443 \u043c\u043e\u0435\u0433\u043e \u0434\u0435\u0442\u0441\u0442\u0432\u0430:<\/p>\n<figure class=\"\"><figcaption>\u0411\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0430 \u043c\u043e\u0435\u0433\u043e \u0434\u0435\u0442\u0441\u0442\u0432\u0430<\/figcaption><\/figure>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f \u0432\u043e\u0442, \u043e \u0447\u0435\u043c: \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0430\u043c\u0435\u0440\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043c\u0430\u0448\u0438\u043d\u043a\u043e\u0439, \u043d\u043e \u0438\u0433\u0440\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0439. \u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. \u0423\u0441\u0442\u0440\u0430\u043d\u0438\u043c \u044d\u0442\u043e \u0434\u043e\u0441\u0430\u0434\u043d\u043e\u0435 \u043d\u0435\u0434\u043e\u0440\u0430\u0437\u0443\u043c\u0435\u043d\u0438\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Initialize \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Updated \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Update:<\/p>\n<pre><code class=\"cs\">Updated.Invoke(this, new GameplayEventArgs() {     Objects = Objects,     POVShift = Objects[PlayerId].Pos     });<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u043d\u043e \u043d\u0435 \u0442\u0443\u0434\u0430, \u043a\u0443\u0434\u0430 \u043d\u0430\u0434\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 POVShift \u0440\u0430\u0432\u043d\u044b\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0435 \u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0433\u043b\u0430 \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u043c\u0430\u0448\u0438\u043d\u043a\u0438. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0437 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e POVShift \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f X \u0438 Y \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435, \u0442\u043e \u0435\u0441\u0442\u044c, \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u044d\u043a\u0440\u0430\u043d\u0430:<\/p>\n<pre><code class=\"cs\">Updated.Invoke(this, new GameplayEventArgs() {     Objects = Objects,     POVShift = new Vector2(       Objects[PlayerId].Pos.X - 512 + 38,       Objects[PlayerId].Pos.Y - 512 + 50) });<\/code><\/pre>\n<p>\u042f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0435\u0435 \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u043f\u043e \u043e\u0441\u0438 OX \u0438 \u0441\u043c\u0435\u0441\u0442\u0438\u043b \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 512 \u043f\u043e OY \u0432\u043d\u0438\u0437, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0432 \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u043a\u0440\u0430\u043d\u0430:<\/p>\n<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043a\u0440\u0438\u0432\u043e \u043e\u0442\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0442\u0440\u0430\u0441\u0441\u0430 \u2014 \u0435\u0441\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u0438 \u043a\u0440\u0430\u044f \u044d\u043a\u0440\u0430\u043d\u0430, \u0442\u043e \u043e\u043d\u0430 \u0440\u043e\u0432\u043d\u043e \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0440\u0430\u0441\u0441\u0443 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u043d\u043e\u0439 \u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u0432 \u0435\u0435 \u043d\u0430\u0447\u0430\u043b\u0435 (\u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0438\u0437\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0441\u044c OY \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043d\u0438\u0437):  <\/p>\n<pre><code class=\"cs\">\/\/&lt;.......................> \/\/\u0414\u043b\u0438\u043d\u0430 \u0442\u0440\u0430\u0441\u0441\u044b \u0442\u0435\u043f\u0435\u0440\u044c 500 \u0442\u0430\u0439\u043b\u043e\u0432 private char[,] _map = new char [10, 500]; private int _tileSize = 100;  public int PlayerId { get; set; } public Dictionary&lt;int, IObject> Object { get; set; }  public void Initialize() {   Objects = new Dictionary&lt;int, IObject>();   _map[5, 498] = 'P'; \/\/\u041f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0442\u0440\u0430\u0441\u0441\u044b   _map[4, 4] = 'C';   _map[6, 6] = 'C';   _currentId = 1;   bool isPlacedPlayer = false;   \/\/&lt;.......................>   }<\/code><\/pre>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435\u043c. \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0448 \u043c\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432\u043f\u0435\u0440\u0435\u0434-\u043d\u0430\u0437\u0430\u0434, \u043d\u043e \u043d\u0430 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430\u0445 \u043c\u0430\u0448\u0438\u043d\u0443 \u0437\u0430\u043d\u043e\u0441\u0438\u0442, \u0434\u0430 \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u043f\u0440\u043e\u043f\u0438\u0448\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043b\u0430 \u0431\u043e\u043a\u043e\u0432\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f: <\/p>\n<pre><code class=\"cs\">public class Car : IObject {   public int ImageId { get; set; }     public Vector2 Pos { get; set; }      public void Update()     {         Pos += Speed;         Speed = new Vector2(0, Speed.Y);             } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0448 \u0432\u043b\u0435\u0432\u043e-\u0432\u043f\u0440\u0430\u0432\u043e \u0431\u043e\u043a\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u043d\u0430 1, \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0441\u0434\u0432\u0438\u043d\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 Update, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e, 1 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u043c\u0430\u043b\u043e\u0432\u0430\u0442\u043e, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0437\u043a\u0438\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 GameCycle \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 MovePlayer:<\/p>\n<pre><code class=\"cs\">case IGameplayModel.Direction.right: {     p.Speed += new Vector2(5, 0);     break; } case IGameplayModel.Direction.left: {     p.Speed += new Vector2(-5, 0);     break; }<\/code><\/pre>\n<p>\u0423\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0447\u0442\u043e \u043e\u0441\u044f\u0437\u0430\u0435\u043c\u043e\u0435, \u043d\u043e \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u0434 \u0432 \u043f\u043e\u0440\u044f\u0434\u043e\u043a.<\/p>\n<p><em>\u041c\u0438\u043d\u0443\u0442\u043a\u0430 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430<\/em><\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u0440\u0430\u0437\u0440\u043e\u0441\u0448\u0438\u0439\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u2014 Initalized \u0432 \u041c\u043e\u0434\u0435\u043b\u0438. \u0412 \u043d\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0440\u0430\u0442\u0438\u043c\u043e\u0439 \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u0437\u043e\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439, \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u044b \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u041c\u043e\u0434\u0435\u043b\u0438 \u2014 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0422\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 (<strong><em>\u0441\u043f\u043e\u0439\u043b\u0435\u0440<\/em><\/strong>: \u043f\u043e\u0442\u043e\u043c \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043d\u043e \u043f\u043e\u043a\u0430 \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438).  <\/p>\n<pre><code class=\"cs\">private Car CreateCar (   float x, float y, int spriteId, Vector2 speed) {   Car c = new Car();   c.ImageId = spriteId;   c.Pos = new Vector2(x, y);   c.Speed = speed;   return c; }  private Wall CreateWall(   float x, float y, int spriteId) {   Wall w = new Wall();   w.Pos = new Vector2(x, y);   w.ImageId = spriteId;   return w; }<\/code><\/pre>\n<p>\u0417\u0430\u043e\u0434\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043e\u0442 \u0434\u0443\u0431\u043b\u044f\u0436\u0430 &#8212; \u0438\u0433\u0440\u043e\u043a \u0438 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c. \u0412\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u0432 Initialize, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 GenerateObject:<\/p>\n<pre><code class=\"cs\">private IObject GenerateObject (   char sign, int xTile, int yTile) {   float x = xTile*_tileSize;   float y = yTile*_tileSize;   IObject generatedObject = null;   if (sign == 'P'|| sign == 'C')   {     generatedObject = CreateCar(       x + _tileSize\/2 - 38, y + _tileSize\/2 - 50,     spriteId: 1, speed: new Vector2(0,0));   }   else if (sign == 'W')   {     generatedObject = CreateWall(       x + _tileSize\/2 - 12, y + _tileSize\/2 - 50,   <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-336265","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336265","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=336265"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336265\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}