2018-01-16 14:00:11 +01:00
|
|
|
if (!this.entityLoaded) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.initialized) {
|
2018-01-16 14:03:37 +01:00
|
|
|
|
2018-01-16 14:04:40 +01:00
|
|
|
this.animationSystem = this.entityLoaded.animationSystem;
|
2018-01-16 14:03:37 +01:00
|
|
|
|
2018-01-16 14:16:32 +01:00
|
|
|
this.cylinder = this.entityLoaded.cylinder;
|
|
|
|
|
2018-01-16 14:00:11 +01:00
|
|
|
this.initialized = true;
|
|
|
|
}
|
|
|
|
|
2018-01-16 14:55:50 +01:00
|
|
|
while (this.cylinder.rotation.x < 0) {
|
2018-01-16 15:00:28 +01:00
|
|
|
this.cylinder.rotation.x += Math.PI * 2;
|
2018-01-16 14:56:33 +01:00
|
|
|
this.cylinder.updateInstance('rotation');
|
2018-01-16 14:55:50 +01:00
|
|
|
}
|
|
|
|
|
2018-01-17 11:58:30 +01:00
|
|
|
!this.animationSystem.started && this.animationSystem.start();
|
2018-01-16 14:22:03 +01:00
|
|
|
|
2018-01-16 14:45:11 +01:00
|
|
|
var currentRotation = this.cylinder.rotation.x;
|
2018-01-16 14:20:06 +01:00
|
|
|
|
2018-01-16 14:44:44 +01:00
|
|
|
var number = 0.897597901;
|
2018-01-16 14:40:47 +01:00
|
|
|
|
|
|
|
var remainder = currentRotation % number;
|
2018-01-16 14:16:32 +01:00
|
|
|
|
2018-01-16 14:53:37 +01:00
|
|
|
var result = number - remainder;
|
|
|
|
|
2018-01-16 15:03:47 +01:00
|
|
|
//console.log('current rotation: ' + currentRotation + ' remainder : ' + remainder + ' result: ' + result);
|
2018-01-16 14:31:33 +01:00
|
|
|
|
2018-01-16 14:55:50 +01:00
|
|
|
this.cylinder.rotation.x += result - 0.4488;
|
2018-01-16 14:30:56 +01:00
|
|
|
|
2018-01-17 14:52:17 +01:00
|
|
|
GameLib.Event.Emit(
|
|
|
|
GameLib.Event.PLAY_AUDIO,
|
|
|
|
{
|
|
|
|
name : 'Audio - Select'
|
|
|
|
}
|
|
|
|
);
|
2018-01-16 14:30:56 +01:00
|
|
|
|
|
|
|
//var offset = currentRotation / 0.4488;
|
|
|
|
|
|
|
|
//var integer = Math.floor(offset);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (remainder > 0.5) {
|
|
|
|
// this.cylinder.rotation.x = (integer + 1) * 0.4488 * 2 - 0.4488;
|
|
|
|
//} else {
|
|
|
|
// this.cylinder.rotation.x = (integer) * 0.4488 * 2 - 0.4488;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//console.log('offset:' + offset + ', remainder: ' + remainder);
|
2018-01-16 14:16:32 +01:00
|
|
|
|
2018-01-16 14:22:03 +01:00
|
|
|
|
2018-01-16 14:04:40 +01:00
|
|
|
|
2018-01-16 15:03:47 +01:00
|
|
|
//console.log('started');
|
2018-01-16 14:05:27 +01:00
|
|
|
|
2018-01-16 14:04:40 +01:00
|
|
|
//console.log(data);
|
2018-01-16 14:00:11 +01:00
|
|
|
//@ sourceURL=SpoonLibMouseUp.js
|