Skip to content

Commit e534fb8

Browse files
committed
add Game Loop Pattern 游戏循环模式
add Game Loop Pattern 游戏循环模式
1 parent 7025c5a commit e534fb8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Assets/Game Programming Patterns/Game Loop Pattern/Example/GameLoopPatternExample.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void Start()
1818
{
1919
//进行游戏循环
2020
//DoGameLoop();
21-
Debug.Log("Unity已经内建了游戏循环模式,即Update( ),自己实现会导致卡死。这边仅保留代码框架,不作调用");
21+
Debug.Log("Unity已经内建了游戏循环模式,即Update( ),按《游戏编程模式》书中的原版实现会导致卡死。这边仅保留代码框架,不作调用");
2222
}
2323

2424
void Update()
@@ -71,15 +71,15 @@ public void DoGameLoop()
7171
double elapsed = current - previous;
7272
previous = current;
7373
lag += elapsed;
74-
//ProcessInput();
74+
ProcessInput();
7575

7676
while (lag >= MS_PER_UPDATE)
7777
{
78-
//Update();
78+
Update();
7979
lag -= MS_PER_UPDATE;
8080
}
8181

82-
//Render();
82+
Render();
8383
}
8484
}
8585

0 commit comments

Comments
 (0)