objects locking system

This commit is contained in:
2025-11-13 16:32:55 +02:00
parent c8e501ff6e
commit a2f9f73e85
10 changed files with 119 additions and 56 deletions
+12 -10
View File
@@ -5,6 +5,7 @@ import {
import { Text } from "troika-three-text";
class DashBoard {
#points = 0;
constructor(engine) {
let svg = p=>`<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
@@ -25,7 +26,6 @@ class DashBoard {
let updating = false;
let params = {}
let occupied = false;
let points = 0;
img.addEventListener('load', function () {
ctx.drawImage(img, 0, 0, engine.w, engine.h);
@@ -152,13 +152,13 @@ class DashBoard {
this.levelProgress = levelProgress;
this.addPoints = function(p){
points += p;
this.#points += p;
engine.motionQueue.add({
o: pointsText,
a: {rotation:{y: Math.PI}, scale:{x:1.5, y:1.5, z:1.5}},
t: 0.25,
f:()=>{
pointsText.text = points;
pointsText.text = this.#points;
pointsText.sync();
engine.motionQueue.add({
o: pointsText,
@@ -242,13 +242,11 @@ class DashBoard {
object._hud.parent?.attach(object);
hud.rotation.y = 0;
hud.visible = false;
if (!opts.skipTransition){
engine.motionQueue.add({
o: object,
a: object._hud.placement,
t: 1
});
}
engine.motionQueue.add({
o: object,
a: object._hud.placement,
t: opts.skipTransition ? 0 : 1
});
delete object._hud;
occupied = false;
hudAnimation = null;
@@ -268,6 +266,10 @@ class DashBoard {
set active(v){
this.group.visible = v;
}
get points(){
return this.#points;
}
}
class ProgressBar{