Skip to content

Commit

Permalink
refactor(ecs): add ICollidableComponent and move IComponent into inte…
Browse files Browse the repository at this point in the history
…rfaces dir
  • Loading branch information
RuggeroVisintin committed Dec 9, 2023
1 parent 66b87af commit aa645af
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ecs/components/BaseComponent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Type } from "../../core";
import { IEntity } from "../entities";
import { IComponent } from "./IComponent";
import { IComponent } from "./interfaces";

@Type('BaseComponent')
export class BaseComponent implements IComponent {
Expand Down
2 changes: 1 addition & 1 deletion src/ecs/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './IComponent';
export * from './interfaces';
export * from './BaseComponent';
export * from './TransformComponent';
export * from './ShapeComponent';
Expand Down
5 changes: 5 additions & 0 deletions src/ecs/components/interfaces/ICollidableComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { IComponent } from "./IComponent";

export interface ICollidableComponent extends IComponent {
onCollision(collider: ICollidableComponent): void;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IEntity } from "../entities";
import { IEntity } from "../../entities";

export interface IComponent {
getContainer(): IEntity | null;
Expand Down
2 changes: 2 additions & 0 deletions src/ecs/components/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './ICollidableComponent';
export * from './IComponent';

0 comments on commit aa645af

Please sign in to comment.