Skip to content

Commit

Permalink
uppdate ui logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gonpombo8 committed Oct 19, 2023
1 parent d30fe7c commit 5398e9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function createTriangle(entityFactory: NetworkManager, x: number, y: numb

export function createCircle(entityFactory: NetworkManager, x: number, y: number, z: number, sync: boolean = true) {
const entity = createCube(entityFactory, x, y, z, sync)
MeshRenderer.setCylinder(entity, 3, 3)
MeshCollider.setCylinder(entity, 3, 3)
MeshRenderer.setCylinder(entity, 1, 1)
MeshCollider.setCylinder(entity, 1, 1)
return entity
}

Expand Down
10 changes: 6 additions & 4 deletions test/build-ecs/fixtures/sdk7-humming-birds-sync/src/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ export function setupUi(userId: string) {
value="Create Local (Circle)"
fontSize={18}
uiTransform={{ width: '100%', height: 40 }}
onMouseDown={() =>
createCircle(engine, Math.random() * 24 + 23, Math.random() * 2, Math.random() * 24 + 23, false)
}
onMouseDown={() => {
const { x, y, z } = Transform.get(engine.PlayerEntity).position
createCircle(engine, x, y, z, false)
}}
/>
{scoreBoard.map(($) => (
<Label
Expand All @@ -146,7 +147,8 @@ export function setupUi(userId: string) {
}

function handleCreateTriangle() {
const entity = createTriangle(engine, Math.random() * 24, Math.random() * 2, Math.random() * 24)
const { x, y, z } = Transform.get(engine.PlayerEntity).position
const entity = createTriangle(engine, x, y, z)
addNetworkEntity(entity)
}

Expand Down

0 comments on commit 5398e9a

Please sign in to comment.