Add behavior modular

This commit is contained in:
MrKBear 2022-02-17 17:34:20 +08:00
parent 12ce98bc44
commit 64e22eb3f6

50
source/Model/Behavior.ts Normal file
View File

@ -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<EventType, any>
> extends Emitter<E> {
/**
* 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 };