Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added separator dots to timer3D #49

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added mini-game-assets/models/ui/double_dot.glb
Binary file not shown.
19 changes: 18 additions & 1 deletion src/ui/timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class Timer3D {
root: Entity
seconds: Counter3D
minutes?: Counter3D
dots: Entity

constructor(
transform: TransformTypeWithOptionals,
Expand All @@ -19,7 +20,7 @@ export class Timer3D {
const {
engine,
tweenSystem,
components: { Transform, Tween }
components: { Transform, Tween, GltfContainer, VisibilityComponent }
} = getSDK()
this.root = engine.addEntity()
Transform.create(this.root, transform)
Expand All @@ -35,6 +36,8 @@ export class Timer3D {
id * 100
)
this.seconds.setNumber(0)
this.dots = engine.addEntity()
VisibilityComponent.createOrReplace(this.dots)

if (sections > 1) {
this.minutes = new Counter3D(
Expand All @@ -48,6 +51,12 @@ export class Timer3D {
id * 100 + 1
)
this.minutes.setNumber(0)
Transform.createOrReplace(this.dots, {
parent: this.root,
position: Vector3.create(2 * spacing - 0.85, 0, 0),
scale: Vector3.create(1.7, 1.7, 1.7)
})
GltfContainer.createOrReplace(this.dots, { src: 'mini-game-assets/models/ui/double_dot.glb' })
}

engine.addSystem(() => {
Expand Down Expand Up @@ -93,15 +102,23 @@ export class Timer3D {
}
}
hide() {
const {
components: { VisibilityComponent }
} = getSDK()
this.seconds.hide()
if (this.minutes) {
this.minutes.hide()
}
VisibilityComponent.getMutable(this.dots).visible = false
}
show() {
const {
components: { VisibilityComponent }
} = getSDK()
this.seconds.show()
if (this.minutes) {
this.minutes.show()
VisibilityComponent.getMutable(this.dots).visible = true
}
}
}
Loading