摘要: # component不同作用的程序需要保持互相隔离我们不想ai 物理 渲染 声音 等等功能 耦合在一起,像下面这样```//bad if (collidingWithFloor() && (getRenderState() != INVISIBLE)){ playSound(HIT_FLOOR)... 阅读全文
posted @ 2015-01-20 18:17 summernight 阅读(244) 评论(0) 推荐(0) 编辑
摘要: ### Behavioral Pattern#### interpreter pattern string -> code instruction set: 提供基本操作virtual machine: 执行指令front-end: 生成效率更高的字节码```void setHe... 阅读全文
posted @ 2015-01-20 17:38 summernight 阅读(179) 评论(0) 推荐(0) 编辑
摘要: awake 只调用一次, awake在所有obj都初始化之后被调用. 用途: 初始化游戏状态 设置脚本间的引用 ### ExecuteInEditMode 编辑模式下```这个模式下,脚本编译,会自动reload[ExecuteInEdit... 阅读全文
posted @ 2015-01-20 15:38 summernight 阅读(391) 评论(0) 推荐(0) 编辑
摘要: ```while (true){ Event* event = waitForEvent(); dispatchEvent(event);}while (true){ processInput(); update(); render();}```游戏循环在游戏运行期间一直执行,每次循环,会... 阅读全文
posted @ 2015-01-20 14:22 summernight 阅读(126) 评论(0) 推荐(0) 编辑