File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1611,7 +1611,7 @@ Component+GameObject层为组件和GameObject,它们现在只是有一个numbe
16111611
16121612
16131613- OtherComponentManager
1614- 该角色是一种其它组件的Manager,负责维护和管理该种组件的所有组件数据,将其保存在Hash Map中,每个Hash Map保存一类数据
1614+ 该角色是一种其它组件的Manager,负责维护和管理该种组件的所有组件数据,将其保存在Map中,每个Map保存一类数据
16151615
16161616
16171617我们看下Component+GameObject这一层:
@@ -1953,7 +1953,7 @@ other_component1/ManagerStateType
19531953``` ts
19541954export type state = {
19551955 maxUID: number ,
1956- // value1Map是Hash Map,用来保存该种组件所有的value1数据
1956+ // value1Map用来保存该种组件所有的value1数据
19571957 value1Map: Map <component , value1 type >,
19581958 更多valueXMap ...,
19591959
@@ -2099,7 +2099,10 @@ World、System、Manager、Component+GameObject这几个层只能上层依赖下
20992099## 缺点
21002100
21012101- 需要转换为函数式编程的思维
2102- 习惯面向对象编程的同学倾向于设计一个组件是一个包括数据和逻辑的类,而ECS模式则将其扁平化为一个值对象,也就是一个组件变成了一个数据,这更符合函数式编程的思维模式
2102+ 习惯面向对象编程的同学倾向于设计一个组件是一个包括数据和逻辑的类,而ECS模式则将其扁平化为一个值对象,也就是一个组件变成了一个数据,这更符合函数式编程中一切都是数据的思维模式
2103+ 另外,ECS中的System其实就只是一个函数而已,本身没有数据,这也符合函数式编程中函数是第一公民的思维模式
2104+ 所以,如果是使用函数式编程范式的同学能够更容易地使用ECS模式
2105+
21032106
21042107<!-- - 实现起来比较复杂 -->
21052108
You can’t perform that action at this time.
0 commit comments