Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

三、行为模式

Behavioral Patterns

当游戏对象的行为变得复杂,硬编码会让代码迅速腐烂。本部分介绍如何为对象赋予灵活、可扩展、可替换的行为。