diff --git a/source/Model/Behavior.ts b/source/Model/Behavior.ts new file mode 100644 index 0000000..4f03c62 --- /dev/null +++ b/source/Model/Behavior.ts @@ -0,0 +1,50 @@ +import { IAnyObject } from "./Renderer"; +import { Emitter, EventType } from "./Emitter"; +import type { Individual } from "./Individual"; +import type { Group } from "./Group"; + +/** + * 群体的某种行为 + */ +abstract class Behavior< + P extends IAnyObject, E extends Record +> extends Emitter { + + /** + * 行为 ID + */ + abstract id: string; + + /** + * 行为名称 + */ + abstract name: string; + + /** + * 行为描述 + */ + public describe?: string = ""; + + /** + * 优先级 + * 值越大执行顺序越靠后 + */ + public priority?: number = 0; + + /** + * 行为参数 + */ + abstract parameter?: P; + + /** + * 作用影响于个体 + * @param individual 影响个体 + * @param group 影响组 + * @param t 经过时间 + */ + abstract effect(individual: Individual, group: Group, t: number): void; + +} + +export { Behavior }; +export default { Behavior }; \ No newline at end of file