-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(ecs): add .matchContainerTransform to allow component to match container transform * docs(examples): update example with matching bounding box * feat(ecs): add StaticObject entity * fix(ecs): fix bounding box component not registered into static object * docs(examples): update SimpleCollision example
- sparkengineweb-v0.12.3
- sparkengineweb-v0.12.2
- sparkengineweb-v0.12.1
- sparkengineweb-v0.12.0
- sparkengineweb-v0.11.5
- sparkengineweb-v0.11.4
- sparkengineweb-v0.11.3
- sparkengineweb-v0.11.2
- sparkengineweb-v0.11.1
- sparkengineweb-v0.11.0
- sparkengineweb-v0.10.12
- sparkengineweb-v0.10.11
- sparkengineweb-v0.10.10
- sparkengineweb-v0.10.9
- sparkengineweb-v0.10.8
- sparkengineweb-v0.10.7
- sparkengineweb-v0.10.6
- sparkengineweb-v0.10.5
- sparkengineweb-v0.10.4
- sparkengineweb-v0.10.3
- sparkengineweb-v0.10.2
- sparkengineweb-v0.10.1
- sparkengineweb-v0.10.0
- sparkengineweb-v0.9.0
- sparkengineweb-v0.8.5
- sparkengineweb-v0.8.4
- sparkengineweb-v0.8.3
- sparkengineweb-v0.8.2
- sparkengineweb-v0.8.1
- sparkengineweb-v0.8.0
- sparkengineweb-v0.7.2
- sparkengineweb-v0.7.1
- sparkengineweb-v0.7.0
- sparkengineweb-v0.6.0
- sparkengineweb-v0.5.1
- sparkengineweb-v0.5.0
- sparkengineweb-v0.4.3
- sparkengineweb-v0.4.2
- sparkengineweb-v0.4.1
- sparkengineweb-v0.4.0
- sparkengineweb-v0.3.1
- sparkengineweb-v0.3.0
- sparkengineweb-v0.2.5
- sparkengineweb-v0.2.4
- sparkengineweb-v0.2.3
- sparkengineweb-v0.2.2
- sparkengineweb-v0.2.1
- sparkengineweb-v0.2.0
- sparkengineweb-v0.1.4
- sparkengineweb-v0.1.3
1 parent
c633a7a
commit 8dbe735
Showing
6 changed files
with
139 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { BoundingBoxComponent } from "../components"; | ||
import { GameObject } from "./GameObject"; | ||
|
||
export class StaticObject extends GameObject { | ||
public boundingBox = new BoundingBoxComponent(); | ||
|
||
constructor() { | ||
super(); | ||
|
||
this.addComponent(this.boundingBox); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './BaseEntity'; | ||
export * from './IEntity'; | ||
export * from './GameObject'; | ||
export * from './GameObject'; | ||
export * from './StaticObject'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { BoundingBoxComponent, GameObject, StaticObject } from "../../../../src" | ||
|
||
describe('ecs/entities/StaticObject', () => { | ||
let staticObject = new StaticObject(); | ||
|
||
afterEach(() => { | ||
staticObject = new StaticObject(); | ||
}) | ||
|
||
describe('.constructor()', () => { | ||
it('Should extend GameObject class', () => { | ||
expect(staticObject).toBeInstanceOf(GameObject); | ||
}) | ||
|
||
it('Should have a bounding box by default', () => { | ||
expect(staticObject.boundingBox).toEqual(expect.objectContaining({ | ||
aabb: { x: 0, y: 0, width: 0, height: 0 }, | ||
})); | ||
}) | ||
|
||
it('Should register this entity as a container of its default components', () => { | ||
expect(staticObject.boundingBox.getContainer()).toBe(staticObject); | ||
}) | ||
}) | ||
}) |