mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:40:11 +02:00
clock working for one person- no baton yet
This commit is contained in:
parent
24ba70263c
commit
1645ace200
1 changed files with 19 additions and 12 deletions
|
@ -25,14 +25,14 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_this.clockBody = _this.userData.clockBody;
|
_this.clockBody = _this.userData.clockBody;
|
||||||
Entities.editEntity(_this.clockBody, {animation: {running: true}});
|
|
||||||
Script.update.connect(_this.update);
|
Script.update.connect(_this.update);
|
||||||
},
|
},
|
||||||
|
|
||||||
unload: function() {
|
unload: function() {
|
||||||
Script.update.disconnect(_this.update);
|
Script.update.disconnect(_this.update);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
_this.clockBodyAnimationProps = Entities.getEntityProperties(_this.clockBody, "animation").animation;
|
_this.clockBodyAnimationProps = Entities.getEntityProperties(_this.clockBody, "animation").animation;
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this.checkTime === false) {
|
if (_this.checkTime === false) {
|
||||||
print ("We are in our refractory period. Please wait.");
|
print("We are in our refractory period. Please wait.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
|
@ -50,16 +50,23 @@
|
||||||
var seconds = date.getSeconds();
|
var seconds = date.getSeconds();
|
||||||
var minutes = date.getMinutes();
|
var minutes = date.getMinutes();
|
||||||
|
|
||||||
if(seconds === 0 && (minutes === 23|| minutes === 24)) {
|
if (seconds === 0 && minutes === 0) {
|
||||||
// We are at the top of the hour!
|
_this.popCuckooOut();
|
||||||
print("TOP OF THE HOUR!");
|
|
||||||
_this.checkTime = false;
|
|
||||||
Script.setTimeout(function() {
|
|
||||||
_this.checkTime = true;
|
|
||||||
_this.print("NOW WE CAN CHECK TIME AGAIN");
|
|
||||||
}, _this.TIME_CHECK_REFRACTORY_PERIOD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
popCuckooOut: function() {
|
||||||
|
// We are at the top of the hour!
|
||||||
|
Entities.editEntity(_this.clockBody, {
|
||||||
|
animation: {
|
||||||
|
running: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_this.checkTime = false;
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
_this.checkTime = true;
|
||||||
|
}, _this.TIME_CHECK_REFRACTORY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue