Update: CC - Entity Loaded - AR Football 3 (ff0fsum4zx.js) 487 bytes modified
parent
6913f29d7b
commit
0eda4c35c5
|
@ -41,13 +41,11 @@ this.playerRotation = {
|
||||||
y : 0
|
y : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.CustomCode.TIME_LIMIT = 1.5 * 60;
|
R3.CustomCode.TIME_LIMIT = 1.5 * 10;
|
||||||
|
|
||||||
this.balls = [];
|
this.balls = [];
|
||||||
|
|
||||||
this.activeBall = this.football.instance;
|
this.canKick = true;
|
||||||
|
|
||||||
this.canKick = false;
|
|
||||||
|
|
||||||
this.kick = false;
|
this.kick = false;
|
||||||
|
|
||||||
|
@ -79,6 +77,8 @@ this.secondCounter = 0;
|
||||||
|
|
||||||
this.ballY = this.football.instance.geometry.boundingSphere.radius / 2;
|
this.ballY = this.football.instance.geometry.boundingSphere.radius / 2;
|
||||||
|
|
||||||
|
this.activeBall = null;
|
||||||
|
|
||||||
if (this.debug) {
|
if (this.debug) {
|
||||||
this.arrowHelper = new THREE.ArrowHelper(
|
this.arrowHelper = new THREE.ArrowHelper(
|
||||||
new THREE.Vector3(0,0,-1),
|
new THREE.Vector3(0,0,-1),
|
||||||
|
@ -88,6 +88,22 @@ if (this.debug) {
|
||||||
this.arScene.instance.add(this.arrowHelper);
|
this.arScene.instance.add(this.arrowHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R3.CustomCode.prototype.createActiveBall = function() {
|
||||||
|
|
||||||
|
this.activeBall = new THREE.Mesh(
|
||||||
|
this.ballGeometry.instance,
|
||||||
|
[
|
||||||
|
this.materialWhite.instance,
|
||||||
|
this.materialBlack.instance
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
this.activeBall.scale.copy(this.football.instance.scale);
|
||||||
|
this.activeBall.position.copy(this.football.instance.position);
|
||||||
|
|
||||||
|
this.football.parentScene.instance.add(this.activeBall);
|
||||||
|
};
|
||||||
|
|
||||||
R3.CustomCode.prototype.render = function(delta) {
|
R3.CustomCode.prototype.render = function(delta) {
|
||||||
|
|
||||||
this.totalTime -= delta;
|
this.totalTime -= delta;
|
||||||
|
@ -351,19 +367,7 @@ R3.CustomCode.prototype.move = function(data) {
|
||||||
|
|
||||||
|
|
||||||
if (this.canKick && this.activeBall === null) {
|
if (this.canKick && this.activeBall === null) {
|
||||||
|
this.createActiveBall();
|
||||||
this.activeBall = new THREE.Mesh(
|
|
||||||
this.ballGeometry.instance,
|
|
||||||
[
|
|
||||||
this.materialWhite.instance,
|
|
||||||
this.materialBlack.instance
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
this.activeBall.scale.copy(this.football.instance.scale);
|
|
||||||
this.activeBall.position.y = this.ballY;
|
|
||||||
|
|
||||||
this.football.parentScene.instance.add(this.activeBall);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.footballPlayer.instance.matrix = new THREE.Matrix4();
|
this.footballPlayer.instance.matrix = new THREE.Matrix4();
|
||||||
|
@ -480,6 +484,16 @@ R3.Event.Subscribe(
|
||||||
R3.Event.GAME_START,
|
R3.Event.GAME_START,
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
|
this.canKick = true;
|
||||||
|
|
||||||
|
this.kick = false;
|
||||||
|
|
||||||
|
this.startTime = null;
|
||||||
|
|
||||||
|
this.kickDuration = 0;
|
||||||
|
|
||||||
|
this.kickDistance = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset football player
|
* Reset football player
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -492,7 +506,6 @@ R3.Event.Subscribe(
|
||||||
this.footballPlayer.instance.position.y = this.playerY;
|
this.footballPlayer.instance.position.y = this.playerY;
|
||||||
this.footballPlayer.instance.position.z = this.football.instance.geometry.boundingSphere.radius;
|
this.footballPlayer.instance.position.z = this.football.instance.geometry.boundingSphere.radius;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset football
|
* Reset football
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -523,7 +536,6 @@ R3.Event.Subscribe(
|
||||||
function(ball) {
|
function(ball) {
|
||||||
|
|
||||||
this.football.parentScene.instance.remove(ball.mesh);
|
this.football.parentScene.instance.remove(ball.mesh);
|
||||||
|
|
||||||
ball.mesh.material = null;
|
ball.mesh.material = null;
|
||||||
ball.mesh.geometry = null;
|
ball.mesh.geometry = null;
|
||||||
delete ball.mesh;
|
delete ball.mesh;
|
||||||
|
@ -534,6 +546,12 @@ R3.Event.Subscribe(
|
||||||
|
|
||||||
this.balls = [];
|
this.balls = [];
|
||||||
|
|
||||||
|
if (this.activeBall) {
|
||||||
|
this.football.parentScene.instance.remove(this.activeBall);
|
||||||
|
this.activeBall.material = null;
|
||||||
|
this.activeBall.geometry = null;
|
||||||
|
}
|
||||||
|
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.PLAY_AUDIO,
|
R3.Event.PLAY_AUDIO,
|
||||||
{
|
{
|
||||||
|
@ -541,6 +559,8 @@ R3.Event.Subscribe(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.createActiveBall();
|
||||||
|
|
||||||
this.mouseMove.entityLoaded = this;
|
this.mouseMove.entityLoaded = this;
|
||||||
this.touchMove.entityLoaded = this;
|
this.touchMove.entityLoaded = this;
|
||||||
this.beforeRender.entityLoaded = this;
|
this.beforeRender.entityLoaded = this;
|
||||||
|
@ -551,6 +571,7 @@ R3.Event.Subscribe(
|
||||||
this.footballPlayer.instance.position.y = this.playerY;
|
this.footballPlayer.instance.position.y = this.playerY;
|
||||||
this.footballPlayer.instance.position.z = this.football.instance.geometry.boundingSphere.radius;
|
this.footballPlayer.instance.position.z = this.football.instance.geometry.boundingSphere.radius;
|
||||||
this.football.instance.position.y = this.ballY;
|
this.football.instance.position.y = this.ballY;
|
||||||
|
this.football.instance.visible = false;
|
||||||
|
|
||||||
R3.Event.Emit(R3.Event.GAME_LOADED);
|
R3.Event.Emit(R3.Event.GAME_LOADED);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue