generate timer events
parent
0094e7a523
commit
31e23e29cf
|
@ -75,6 +75,8 @@ this.totalTime = R3.CustomCode.TIME_LIMIT;
|
||||||
|
|
||||||
this.score = 0;
|
this.score = 0;
|
||||||
|
|
||||||
|
this.secondCounter = 0;
|
||||||
|
|
||||||
this.ballY = this.football.instance.geometry.boundingSphere.radius / 2;
|
this.ballY = this.football.instance.geometry.boundingSphere.radius / 2;
|
||||||
|
|
||||||
if (this.debug) {
|
if (this.debug) {
|
||||||
|
@ -90,6 +92,18 @@ R3.CustomCode.prototype.render = function(delta) {
|
||||||
|
|
||||||
this.totalTime -= delta;
|
this.totalTime -= delta;
|
||||||
|
|
||||||
|
this.secondCounter += delta;
|
||||||
|
if (this.secondCounter >= 1) {
|
||||||
|
this.secondCounter -= 1;
|
||||||
|
R3.Event.Emit(
|
||||||
|
R3.Event.GAME_DATA,
|
||||||
|
{
|
||||||
|
type : 'timer',
|
||||||
|
time : Math.round(this.totalTime)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (this.totalTime <= 0) {
|
if (this.totalTime <= 0) {
|
||||||
|
|
||||||
this.totalTime = 0;
|
this.totalTime = 0;
|
||||||
|
@ -447,17 +461,12 @@ R3.Event.Subscribe(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
setTimeout(
|
|
||||||
function() {
|
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.STOP_AUDIO,
|
R3.Event.STOP_AUDIO,
|
||||||
{
|
{
|
||||||
name : 'Audio - Crowd'
|
name : 'Audio - Crowd'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
|
||||||
1500
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mouseMove.entityLoaded = null;
|
this.mouseMove.entityLoaded = null;
|
||||||
this.touchMove.entityLoaded = null;
|
this.touchMove.entityLoaded = null;
|
||||||
|
@ -501,8 +510,18 @@ R3.Event.Subscribe(
|
||||||
|
|
||||||
this.score = 0;
|
this.score = 0;
|
||||||
|
|
||||||
|
this.secondCounter = 0;
|
||||||
|
|
||||||
this.totalTime = R3.CustomCode.TIME_LIMIT;
|
this.totalTime = R3.CustomCode.TIME_LIMIT;
|
||||||
|
|
||||||
|
R3.Event.Emit(
|
||||||
|
R3.Event.GAME_DATA,
|
||||||
|
{
|
||||||
|
type : 'timer',
|
||||||
|
time : this.totalTime
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.balls.map(
|
this.balls.map(
|
||||||
function(ball) {
|
function(ball) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue