支持可以任意参数

This commit is contained in:
YHH
2025-08-12 11:47:18 +08:00
parent 56dd18b983
commit baeb047e27
5 changed files with 8 additions and 6 deletions

View File

@@ -335,7 +335,7 @@ export class Entity {
*/
public createComponent<T extends Component>(
componentType: ComponentType<T>,
...args: unknown[]
...args: any[]
): T {
const component = new componentType(...args);
return this.addComponent(component);
@@ -508,7 +508,7 @@ export class Entity {
*/
public getOrCreateComponent<T extends Component>(
type: ComponentType<T>,
...args: unknown[]
...args: any[]
): T {
let component = this.getComponent(type);
if (!component) {