Update: CC - Entity Loaded - AR Football 3 (ff0fsum4zx.js) 42 bytes modified

beta.r3js.org
-=yb4f310 2018-05-28 18:58:55 +02:00
parent f814179965
commit 2fdc7af240
1 changed files with 68 additions and 1 deletions

View File

@ -10,6 +10,8 @@ if (data.entity === this.parentEntity) {
this.mouseMove = R3.EntityManager.Instance.findComponentById('dwxvtxzrun');
this.touchMove = R3.EntityManager.Instance.findComponentById('p49pad0i7l');
this.beforeRender = R3.EntityManager.Instance.findComponentById('7l8ar325qf');
this.keyDown = R3.EntityManager.Instance.findComponentById('905x4c8pna');
this.keyUp = R3.EntityManager.Instance.findComponentById('r5kzahijoq');
/**
* Meshes
@ -83,6 +85,8 @@ this.invertY = true;
this.invertX = true;
this.shooting = false;
if (this.debug) {
this.arrowHelper = new THREE.ArrowHelper(
new THREE.Vector3(0,0,-1),
@ -118,7 +122,22 @@ R3.CustomCode.prototype.render = function(delta) {
type : 'timer',
time : this.totalTime
}
)
);
if (this.shooting === true) {
this.move(
{
x : 0,
y : 10 * delta
}
);
if (this.playerRotation.y < 0) {
this.playerRotation.y = 0;
this.shooting = false;
}
}
if (this.totalTime <= 0) {
@ -497,6 +516,52 @@ R3.Event.Subscribe(
this.mouseMove.entityLoaded = null;
this.touchMove.entityLoaded = null;
this.beforeRender.entityLoaded = null;
this.keyDown.entityLoaded = null;
this.keyUp.entityLoaded = null;
}.bind(this)
);
R3.Event.Subscribe(
R3.Event.GAME_DATA,
function(data) {
if (data.type === 'shoot') {
console.log('shoot');
this.shooting = false;
this.move(
{
x : 0,
y : -10
}
);
}
if (data.type === 'shoot_release') {
console.log('shoot release');
this.shooting = true;
}
if (data.type === 'look_left') {
this.move(
{
x : -10,
y : 0
}
);
}
if (data.type === 'look_right') {
this.move(
{
x : 10,
y : 0
}
);
}
}.bind(this)
);
@ -586,6 +651,8 @@ R3.Event.Subscribe(
this.mouseMove.entityLoaded = this;
this.touchMove.entityLoaded = this;
this.beforeRender.entityLoaded = this;
this.keyDown.entityLoaded = this;
this.keyUp.entityLoaded = this;
}.bind(this)
);