{"id":291094,"date":"2018-10-20T16:35:02","date_gmt":"2018-10-20T12:35:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=291094"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=291094","title":{"rendered":"\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043a\u0430\u0442\u0441\u0446\u0435\u043d \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0432 \u0438\u0433\u0440\u0430\u0445"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0438 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440\u0430\u0445. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c <a href=\"https:\/\/eliasdaler.github.io\/how-to-implement-action-sequences-and-cutscenes\/\">\u0432\u043e\u0442 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u0438 \u043f\u043e \u044d\u0442\u043e\u0439 \u0436\u0435 \u0442\u0435\u043c\u0435 \u044f \u0434\u0435\u043b\u0430\u043b \u0434\u043e\u043a\u043b\u0430\u0434 \u043d\u0430 Lua in Moscow, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0438\u0434\u0435\u043e, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/youtu.be\/IUtJJhQSLek?t=6h33m24s\">\u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u041a\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Lua, \u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u0442.\u043a. \u043e\u043d\u0438 \u0435\u0441\u0442\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u044f\u0437\u044b\u043a\u0430\u0445).<\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<pre><code class=\"lua\">local function cutscene(player, npc)   player:goTo(npc)   if player:hasCompleted(quest) then     npc:say(\"You did it!\")     delay(0.5)     npc:say(\"Thank you\")   else     npc:say(\"Please help me\")   end end <\/code><\/pre>\n<h1>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h1>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u0430\u0445: \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442 \u0432\u0440\u0430\u0433\u0430, \u0447\u0442\u043e-\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0435\u043c\u0443, \u0432\u0440\u0430\u0433 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0438 \u0432 \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0435. \u0412\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 \u044d\u0442\u0443 \u0433\u0438\u0444\u043a\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5k\/ry\/ik\/5kryik8wvq-b4ifoa3k3iobvolw.gif\"><\/p>\n<p>  1. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0435\u0440\u044c<br \/>  2. \u041f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u043e\u043c<br \/>  3. \u0414\u0432\u0435\u0440\u044c \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f<br \/>  4. \u042d\u043a\u0440\u0430\u043d \u043f\u043b\u0430\u0432\u043d\u043e \u0442\u0435\u043c\u043d\u0435\u0435\u0442<br \/>  5. \u041c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0440\u043e\u0432\u0435\u043d\u044c<br \/>  6. \u042d\u043a\u0440\u0430\u043d \u043f\u043b\u0430\u0432\u043d\u043e \u0441\u0432\u0435\u0442\u043b\u0435\u0435\u0442<br \/>  7. \u041f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0432 \u043a\u0430\u0444\u0435<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f NPC \u0438\u043b\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0431\u0438\u0442\u0432 \u0441 \u0431\u043e\u0441\u0441\u0430\u043c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u043e\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043e\u0434\u043d\u043e \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h1>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h1>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e\u0439. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uc\/xs\/an\/ucxsanil2ovbawdzqehjmfjpja4.png\" width=\"240\"><\/p>\n<pre><code class=\"lua\">while game:isRunning() do   processInput()   dt = clock.delta()   update(dt)   render() end <\/code><\/pre>\n<p>  \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u0443: \u0438\u0433\u0440\u043e\u043a \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a NPC, NPC \u0433\u043e\u0432\u043e\u0440\u0438\u0442:\u00abYou did it!\u00bb, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439 \u043f\u0430\u0443\u0437\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u0442:\u00abThank you!\u00bb. \u0412 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435, \u043c\u044b \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u044d\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"lua\">player:goTo(npc) npc:say(\"You did it!\") delay(0.5) npc:say(\"Thank you\") <\/code><\/pre>\n<p>  \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043c\u044b \u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0434\u0430\u0436\u0435 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0432\u0432\u043e\u0434\u0430 \u043e\u0442 \u0438\u0433\u0440\u043e\u043a\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043e\u043a\u043d\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0430). \u0412\u043c\u0435\u0441\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>delay<\/code> \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 <code>sleep<\/code> \u2014 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a, \u0431\u0443\u0434\u0442\u043e \u0438\u0433\u0440\u0430 \u0437\u0430\u0432\u0438\u0441\u043b\u0430. <\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0445\u043e\u0434\u043e\u0432 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h1>bool, enum, \u043c\u0430\u0448\u0438\u043d\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439<\/h1>\n<p>  \u0421\u0430\u043c\u044b\u0439 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043b\u044f \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u2014 \u044d\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0432 bool&#8217;\u0430\u0445, \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0438\u043b\u0438 enum&#8217;\u0430\u0445. \u041a\u043e\u0434 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"lua\">function update(dt)   if cutsceneState == 'playerGoingToNpc' then     player:continueGoingTo(npc)     if player:closeTo(npc) then       cutsceneState = 'npcSayingYouDidIt'       dialogueWindow:show(\"You did it!\")     end   elseif cutsceneState == 'npcSayingYouDidIt' then     if dialogueWindow:wasClosed() then       cutsceneState = 'delay'     end   elseif ...     ... -- \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435...   end end <\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u043f\u0430\u0433\u0435\u0442\u0442\u0438-\u043a\u043e\u0434\u0443 \u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u043c \u0446\u0435\u043f\u043e\u0447\u043a\u0430\u043c if-else \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h1>Action list<\/h1>\n<p>  Action list&#8217;\u044b \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439. Action list \u2014 \u044d\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c. \u0412 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>update<\/code>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0432\u043e\u0434 \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0438\u0433\u0440\u0443, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e, \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e.<\/p>\n<p>  \u0412 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f: GoToAction, DialogueAction \u0438 DelayAction.<\/p>\n<p>  \u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/kikito\/middleclass\">middleclass<\/a> \u0434\u043b\u044f \u041e\u041e\u041f \u0432 Lua.<\/p>\n<p>  \u0412\u043e\u0442, \u043a\u0430\u043a \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f <code>DelayAction<\/code>:<\/p>\n<pre><code class=\"lua\">-- \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 function DelayAction:initialize(params)   self.delay = params.delay    self.currentTime = 0   self.isFinished = false end  function DelayAction:update(dt)   self.currentTime = self.currentTime + dt   if self.currentTime &gt; self.delay then     self.isFinished = true   end end <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>ActionList:update<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"lua\">function ActionList:update(dt)   if not self.isFinished then     self.currentAction:update(dt)     if self.currentAction.isFinished then       self:goToNextAction()       if not self.currentAction then         self.isFinished = true       end     end   end end <\/code><\/pre>\n<p>  \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0441\u0430\u043c\u043e\u0439 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b:<\/p>\n<pre><code>function makeCutsceneActionList(player, npc)   return ActionList:new {     GoToAction:new {       entity = player,       target = npc     },     SayAction:new {       entity = npc,       text = \"You did it!\"     },     DelayAction:new {       delay = 0.5     },     SayAction:new {       entity = npc,       text = \"Thank you\"     }   } end  -- ... \u0433\u0434\u0435-\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 actionList:update(dt) <\/code><\/pre>\n<p>  <i>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/i>: \u0432 Lua \u0432\u044b\u0437\u043e\u0432 <code>someFunction({ ... })<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u043d \u0432\u043e\u0442 \u0442\u0430\u043a: <code>someFunction{...}<\/code>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c <code>DelayAction:new{ delay = 0.5 }<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>DelayAction:new({delay = 0.5})<\/code>.<\/p>\n<p>  \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435. \u0412 \u043a\u043e\u0434\u0435 \u044f\u0432\u043d\u043e \u0432\u0438\u0434\u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043c\u044b \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 <code>DelayAction<\/code>, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0441\u0446\u0435\u043d \u0443\u0434\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p>  \u0421\u043e\u0432\u0435\u0442\u0443\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0428\u043e\u043d\u0430 \u041c\u0438\u0434\u0434\u043b\u0434\u0438\u0442\u0447\u0430 (Sean Middleditch) \u043f\u0440\u043e action list&#8217;\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b.<\/p>\n<div class=\"oembed\">\n<div>\n<div style=\"left: 0; width: 100%; height: 0; position: relative; padding-bottom: 56.2493%;\"><iframe src=\"https:\/\/www.youtube.com\/embed\/o6CaB-hmqoE?rel=0&amp;showinfo=1&amp;hl=en-US\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen scrolling=\"no\"><\/iframe><\/div>\n<\/div>\n<\/div>\n<p>  Action list&#8217;\u044b \u0432 \u0446\u0435\u043b\u043e\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0438\u0445 \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u0438\u0433\u0440 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u0431\u044b\u043b \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432. \u041d\u043e \u0438 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u0443:<\/p>\n<pre><code class=\"lua\">local function cutscene(player, npc)   player:goTo(npc)   if player:hasCompleted(quest) then     npc:say(\"You did it!\")     delay(0.5)     npc:say(\"Thank you\")   else     npc:say(\"Please help me\")   end end <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e if\/else, \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u0441\u043f\u0438\u0441\u043a\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u044d\u0433\u043e\u0432. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0442\u044d\u0433\u0430\u043c\u0438, \u0438 \u0437\u0430\u0442\u0435\u043c \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e, \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e, \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u044b\u0439 \u0442\u044d\u0433. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0438\u0448\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0448\u0435.<\/p>\n<p>  \u041a\u043e\u0440\u0443\u0442\u0438\u043d\u044b Lua \u0434\u0435\u043b\u0430\u044e\u0442 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<h1>\u041a\u043e\u0440\u0443\u0442\u0438\u043d\u044b<\/h1>\n<p>  <\/p>\n<h2>\u041e\u0441\u043d\u043e\u0432\u044b \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u0432 Lua<\/h2>\n<p>  \u041a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043f\u0430\u0443\u0437\u0443 \u0438 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0437\u0436\u0435 \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0451 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u041a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0436\u0435 \u043f\u043e\u0442\u043e\u043a\u0435, \u043a\u0430\u043a \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430. \u041d\u043e\u0432\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0434\u043b\u044f \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0443 \u043d\u0430 \u043f\u0430\u0443\u0437\u0443, \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>coroutine.yield<\/code>, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u2014 <code>coroutine.resume<\/code>. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"lua\">local function f()   print(\"hello\")   coroutine.yield()   print(\"world!\") end  local c = coroutine.create(f) coroutine.resume(c) print(\"uhh...\") coroutine.resume(c) <\/code><\/pre>\n<p>  \u0412\u044b\u0432\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre> hello uhh... world <\/pre>\n<p>  \u0412\u043e\u0442, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>coroutine.create<\/code>. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0451 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>coroutine.resume<\/code>. \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>f<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0438\u0448\u0435\u0442 \u00abhello\u00bb \u0438 \u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u0435\u0431\u044f \u043d\u0430 \u043f\u0430\u0443\u0437\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>coroutine.yield<\/code>. \u042d\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 <code>return<\/code>, \u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 <code>f<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>coroutine.resume<\/code>.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>coroutine.yield<\/code>, \u0442\u043e \u043e\u043d\u0438 \u0441\u0442\u0430\u043d\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>coroutine.resume<\/code> \u0432 \u00ab\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435\u00bb. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"lua\">local function f()     ...     coroutine.yield(42, \"some text\")     ... end  ok, num, text = coroutine.resume(c) print(num, text) -- will print '42    \"some text\"' <\/code><\/pre>\n<p>  <code>ok<\/code> \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b. \u0415\u0441\u043b\u0438 <code>ok<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>true<\/code>, \u0442\u043e \u0441 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u043e\u0439 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430 \u043d\u0435\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (<code>num<\/code>, <code>text<\/code>) \u2014 \u044d\u0442\u043e \u0442\u0435 \u0441\u0430\u043c\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0432 <code>yield<\/code>.<\/p>\n<p>  \u0415\u0441\u043b\u0438 <code>ok<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>false<\/code>, \u0442\u043e \u0441 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u043e\u0439 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0451 \u0431\u044b\u043b\u0430 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>error<\/code>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0442\u043e\u0440\u044b\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435. \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0430:<\/p>\n<pre><code class=\"lua\">local function f()   print(1 + notDefined) end  c = coroutine.create(f) ok, msg = coroutine.resume(c) if not ok then     print(\"Coroutine failed!\", msg) end <\/code><\/pre>\n<p>  \u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre> Coroutine failed! input:4: attempt to perform arithmetic on a nil value (global \u2018notDefined\u2019) <\/pre>\n<p>  \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0437\u043e\u0432\u0430 <code>coroutine.status<\/code>. \u041a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u0445:<\/p>\n<ul>\n<li>\u00abrunning\u00bb \u2014 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. <code>coroutine.status<\/code> \u0431\u044b\u043b\u0430 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u043e\u0439 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b<\/li>\n<li>\u00absuspended\u00bb \u2014 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0430 \u043f\u0430\u0443\u0437\u0443 \u0438\u043b\u0438 \u0435\u0449\u0451 \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0430\u0441\u044c<\/li>\n<li>\u00abnormal\u00bb \u2014 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u0430, \u043d\u043e \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f<\/li>\n<li>\u00abdead\u00bb \u2014 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (\u0442.\u0435. \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c)<\/li>\n<\/ul>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0438 \u043a\u0430\u0442\u0441\u0446\u0435\u043d, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043d\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u0445.<\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0441\u0446\u0435\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d<\/h2>\n<p>  \u0412\u043e\u0442, \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Action<\/code> \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435:<\/p>\n<pre><code class=\"lua\">function Action:launch()   self:init()    while not self.finished do     local dt = coroutine.yield()     self:update(dt)   end    self:exit() end <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 action list&#8217;\u044b: \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>update<\/code> \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u043e\u0441\u044c. \u041d\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0438 \u0434\u0435\u043b\u0430\u0435\u043c <code>yield<\/code> \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 (<code>Action:launch<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b). \u0413\u0434\u0435-\u0442\u043e \u0432 <code>update<\/code> \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043c\u044b \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"lua\">coroutine.resume(c, dt) <\/code><\/pre>\n<p>  \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b:<\/p>\n<pre><code class=\"lua\">function cutscene(player, npc)   player:goTo(npc)   npc:say(\"You did it!\")   delay(0.5)   npc:say(\"Thank you\") end  -- \u0433\u0434\u0435-\u0442\u043e \u0432 \u043a\u043e\u0434\u0435... local c = coroutine.create(cutscene, player, npc) coroutine.resume(c, dt) <\/code><\/pre>\n<p>  \u0412\u043e\u0442, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>delay<\/code>:<\/p>\n<pre><code class=\"lua\">function delay(time)     action = DelayAction:new { delay = time }     action:launch() end <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0432\u0440\u0430\u043f\u043f\u0435\u0440\u043e\u0432 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u043a\u0430\u0442\u0441\u0446\u0435\u043d. <code>DelayAction<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"lua\">-- Action - \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 DelayAction local DelayAction = class(\"DelayAction\", Action)  function DelayAction:initialize(params)   self.delay = params.delay   self.currentTime = 0   self.isFinished = false end  function DelayAction:update(dt)   self.currentTime = self.currentTime + dt   if self.currentTime &gt;= self.delayTime then     self.finished = true   end end <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0430 \u0442\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0432 action list&#8217;\u0430\u0445! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043d\u043e\u0432\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>Action:launch<\/code>:<\/p>\n<pre><code class=\"lua\">function Action:launch()   self:init()    while not self.finished do     local dt = coroutine.yield() -- the most important part     self:update(dt)   end    self:exit() end <\/code><\/pre>\n<p>  \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u0437\u0434\u0435\u0441\u044c \u2014 \u0446\u0438\u043a\u043b <code>while<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f. \u042d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/l3\/_n\/xw\/l3_nxwnzshpxqhho12yqyi-y52o.png\"> <\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>goTo<\/code>:  <\/p>\n<pre><code class=\"lua\">function Entity:goTo(target)     local action = GoToAction:new { entity = self, target = target }     action:launch() end  function GoToAction:initialize(params)   ... end  function GoToAction:update(dt)     if not self.entity:closeTo(self.target) then       ... -- \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f, AI     else       self.finished = true     end end <\/code><\/pre>\n<p>  \u041a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043e\u0447\u0435\u0442\u0430\u044e\u0442\u0441\u044f \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 (event&#8217;\u0430\u043c\u0438). \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 <code>WaitForEventAction<\/code>:<\/p>\n<pre><code class=\"lua\">function WaitForEventAction:initialize(params)   self.finished = false    eventManager:subscribe {     listener = self,     eventType = params.eventType,     callback = WaitForEventAction.onEvent   } end  function WaitForEventAction:onEvent(event)   self.finished = true end <\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043c\u0435\u0442\u043e\u0434 <code>update<\/code>. \u041e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f (\u0445\u043e\u0442\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442&#8230;) \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c. \u0412\u043e\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>say<\/code>:<\/p>\n<pre><code class=\"lua\">function Entity:say(text)     DialogueWindow:show(text)     local action = WaitForEventAction:new {       eventType = 'DialogueWindowClosed'     }     action:launch() end <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e \u0438 \u0447\u0438\u0442\u0430\u0435\u043c\u043e. \u041a\u043e\u0433\u0434\u0430 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043e\u043d\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u0442\u0438\u043f\u043e\u043c &#8216;DialogueWindowClosed`. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u00absay\u00bb \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0438 \u0441\u0432\u043e\u0451 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u0430 \u043d\u0438\u043c.<\/p>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432:<\/p>\n<pre><code class=\"lua\">local answer = girl:say('do_you_love_lua',                           { 'YES', 'NO' }) if answer == 'YES' then   girl:setMood('happy')   girl:say('happy_response') else   girl:setMood('angry')   girl:say('angry_response') end <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/t4\/e-\/am\/t4e-amhtwligikstvqtgi8bpyzu.gif\"><\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>say<\/code> \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u0447\u0435\u043c \u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0440\u0430\u043d\u0435\u0435. \u041e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u044b\u0431\u043e\u0440 \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <code>WaitForEventAction<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u043e\u0432\u0438\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>PlayerChoiceEvent<\/code> \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u0435\u0440\u043d\u0451\u0442 \u0432\u044b\u0431\u043e\u0440 \u0438\u0433\u0440\u043e\u043a\u0430, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<h2>\u0427\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/h2>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u044b \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043a\u0432\u0435\u0441\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"lua\">girl:say(\"Kill that monster!\") waitForEvent('EnemyKilled') girl:setMood('happy') girl:say(\"You did it! Thank you!\") <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wx\/du\/kh\/wxdukhci9lald-fph9ypbu5h5fg.gif\"><\/p>\n<p>  \u041a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f AI. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u043d\u0441\u0442\u0440 \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438:<\/p>\n<pre><code class=\"lua\">function followPath(monster, path)   local numberOfPoints = path:getNumberOfPoints()   local i = 0 -- \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u0438 \u0432 \u043f\u0443\u0442\u0438   while true do     monster:goTo(path:getPoint(i))      if i &lt; numberOfPoints - 1 then       i = i + 1 -- \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u0435     else -- \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430       i = 0     end   end end <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/g7\/m4\/ou\/g7m4ouls2l7al6xlovmm-qdbywc.gif\"><\/p>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u043c\u043e\u043d\u0441\u0442\u0440 \u0443\u0432\u0438\u0434\u0438\u0442 \u0438\u0433\u0440\u043e\u043a\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0443 \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0435\u0451. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b (<code>while true<\/code>) \u0432\u043d\u0443\u0442\u0440\u0438 <code>followPath<\/code> \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c.<\/p>\n<p>  \u0415\u0449\u0451 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u00ab\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435\u00bb \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u041a\u0430\u0442\u0441\u0446\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u0442 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043e\u0431\u043e\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u0443, \u0433\u0434\u0435 \u0434\u0435\u0432\u043e\u0447\u043a\u0430 \u0438 \u043a\u043e\u0442 \u0438\u0434\u0443\u0442 \u043a \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u043e\u0447\u043a\u0435 \u0434\u0440\u0443\u0433\u0443 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044f\u043c\u0438. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043a \u043d\u0435\u0439, \u043a\u043e\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u00abmeow\u00bb.<\/p>\n<pre><code class=\"lua\">function cutscene(cat, girl, meetingPoint)   local c1 = coroutine.create(     function()       cat:goTo(meetingPoint)     end)    local c2 = coroutine.create(     function()       girl:goTo(meetingPoint)     end)    c1.resume()   c2.resume()    -- \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f   waitForFinish(c1, c2)    -- \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435   cat:say(\"meow\")   ... end <\/code><\/pre>\n<p>  \u0421\u0430\u043c\u0430\u044f \u0432\u0430\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>waitForFinish<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0440\u0430\u043f\u043f\u0435\u0440\u043e\u043c \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u043b\u0430\u0441\u0441\u0430 <code>WaitForFinishAction<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"lua\">function WaitForFinishAction:update(dt)   if coroutine.status(self.c1) == 'dead' and      coroutine.status(self.c2) == 'dead' then      self.finished = true   else     if coroutine.status(self.c1) ~= 'dead' then       coroutine.resume(self.c1, dt)     end      if coroutine.status(self.c2) ~= 'dead' then       coroutine.resume(self.c2, dt)     end end <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e N-\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. <\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0436\u0434\u0430\u0442\u044c, \u043f\u043e\u043a\u0430 <i>\u043e\u0434\u043d\u0430<\/i> \u0438\u0437 \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f, \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f, \u043f\u043e\u043a\u0430 <i>\u0432\u0441\u0435<\/i> \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0433\u043e\u043d\u043e\u0447\u043d\u044b\u0445 \u043c\u0438\u043d\u0438-\u0438\u0433\u0440\u0430\u0445. \u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435, \u043f\u043e\u043a\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u0433\u043e\u043d\u0449\u0438\u043a\u043e\u0432 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0435\u0442 \u0444\u0438\u043d\u0438\u0448\u0430 \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<h2>\u0414\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043a\u043e\u0440\u0443\u0442\u0438\u043d<\/h2>\n<p>  \u041a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u0438 \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0439\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u041a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u043b\u0435\u0433\u043a\u043e \u0441\u043c\u043e\u0433\u0443\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0434\u0435\u0440\u044b \u0438\u043b\u0438 \u043b\u044e\u0434\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440\u044b \u0438\u0433\u0440 \u0438\u043b\u0438 \u0443\u0440\u043e\u0432\u043d\u0435\u0439).<\/p>\n<p>  \u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438\u043b\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%BE%D1%81%D1%82%D0%BE%D1%8F%D0%BD%D0%B8%D0%B5_%D0%B3%D0%BE%D0%BD%D0%BA%D0%B8\">\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0433\u043e\u043d\u043a\u0438 (race condition)<\/a>.<\/p>\n<p>  \u0423 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0435\u0441\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f\u043c\u0438. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432 \u0432\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0438\u0433\u0440\u043e\u043a \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c\u0441\u044f, \u0442.\u043a. \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b (\u0447\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u0435\u0451 \u0441\u0442\u0435\u043a \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0438), \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0438\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430.<\/p>\n<p>  (<i>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/i>: \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"http:\/\/lua-users.org\/wiki\/PlutoLibrary\">PlutoLibrary<\/a> \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 Lua 5.1)<\/p>\n<p>  \u042d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u0430\u043c\u0438, \u0442.\u043a. \u043e\u0431\u044b\u0447\u043d\u043e \u0432 \u0438\u0433\u0440\u0430\u0445 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u043d\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043a\u0443\u0441\u043a\u0438. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0438\u0433\u0440\u043e\u043a \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0434\u0442\u0438 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u043a\u043e\u043c\u043d\u0430\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442 \u0438\u043b\u0438 \u0434\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u043a\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f. \u0412 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u043c\u044b \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u00ab\u0438\u0433\u0440\u043e\u043a \u043f\u0440\u043e\u0448\u0451\u043b \u0447\u0430\u0441\u0442\u044c 1 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u00bb. \u0414\u0430\u043b\u0435\u0435, \u0438\u0433\u0440\u043e\u043a \u043f\u0440\u043e\u0439\u0434\u0451\u0442 \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0443. \u0418 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435\u2026 \u041f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0447\u043d\u0451\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u0433\u0440\u043e\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0439\u0442\u0438.<\/p>\n<h1>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0438 \u043a\u0430\u0442\u0441\u0446\u0435\u043d \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432. \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u043e\u0434\u0445\u043e\u0434 \u0441 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u043c \u0438 \u044f \u0440\u0430\u0434 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u043c \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0430\u0448\u0443 \u0436\u0438\u0437\u043d\u044c \u043b\u0435\u0433\u0447\u0435 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0430\u043c \u044d\u043f\u0438\u0447\u043d\u044b\u0435 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u0432 \u0432\u0430\u0448\u0438\u0445 \u0438\u0433\u0440\u0430\u0445.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/427135\/\"> https:\/\/habr.com\/post\/427135\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0438 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440\u0430\u0445. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c <a href=\"https:\/\/eliasdaler.github.io\/how-to-implement-action-sequences-and-cutscenes\/\">\u0432\u043e\u0442 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u0438 \u043f\u043e \u044d\u0442\u043e\u0439 \u0436\u0435 \u0442\u0435\u043c\u0435 \u044f \u0434\u0435\u043b\u0430\u043b \u0434\u043e\u043a\u043b\u0430\u0434 \u043d\u0430 Lua in Moscow, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0438\u0434\u0435\u043e, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/youtu.be\/IUtJJhQSLek?t=6h33m24s\">\u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u041a\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Lua, \u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u0442.\u043a. \u043e\u043d\u0438 \u0435\u0441\u0442\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u044f\u0437\u044b\u043a\u0430\u0445).<\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<pre><code class=\"lua\">local function cutscene(player, npc)   player:goTo(npc)   if player:hasCompleted(quest) then     npc:say(\"You did it!\")     delay(0.5)     npc:say(\"Thank you\")   else     npc:say(\"Please help me\")   end end <\/code><\/pre>\n<h1>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h1>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u0430\u0442\u0441\u0446\u0435\u043d\u0430\u0445: \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442 \u0432\u0440\u0430\u0433\u0430, \u0447\u0442\u043e-\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0435\u043c\u0443, \u0432\u0440\u0430\u0433 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0438 \u0432 \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0435. \u0412\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 \u044d\u0442\u0443 \u0433\u0438\u0444\u043a\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5k\/ry\/ik\/5kryik8wvq-b4ifoa3k3iobvolw.gif\"><\/p>\n<p>  1. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0435\u0440\u044c<br \/>  2. \u041f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u043e\u043c<br \/>  3. \u0414\u0432\u0435\u0440\u044c \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f<br \/>  4. \u042d\u043a\u0440\u0430\u043d \u043f\u043b\u0430\u0432\u043d\u043e \u0442\u0435\u043c\u043d\u0435\u0435\u0442<br \/>  5. \u041c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0440\u043e\u0432\u0435\u043d\u044c<br \/>  6. \u042d\u043a\u0440\u0430\u043d \u043f\u043b\u0430\u0432\u043d\u043e \u0441\u0432\u0435\u0442\u043b\u0435\u0435\u0442<br \/>  7. \u041f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0432 \u043a\u0430\u0444\u0435<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f NPC \u0438\u043b\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0431\u0438\u0442\u0432 \u0441 \u0431\u043e\u0441\u0441\u0430\u043c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u043e\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043e\u0434\u043d\u043e \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-291094","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291094","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=291094"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291094\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}