Added coin creator
This commit is contained in:
@@ -8,4 +8,3 @@ L3D.ArrowRecommendation = function(arg1, arg2, arg3, arg4, position, target) {
|
||||
};
|
||||
L3D.ArrowRecommendation.prototype = Object.create(L3D.BaseRecommendation.prototype);
|
||||
L3D.ArrowRecommendation.prototype.constructor = L3D.ArrowRecommendation;
|
||||
|
||||
|
||||
@@ -277,20 +277,20 @@ L3D.createBobombRecommendations = function(width, height) {
|
||||
|
||||
};
|
||||
|
||||
L3D.initBobomb = function(recommendation, scene, coins, clickable) {
|
||||
L3D.initBobomb = function(camera, scene, coins, clickable) {
|
||||
L3D.addLight(scene);
|
||||
|
||||
var collidableObjects = [];
|
||||
L3D.initBobombScene(scene, collidableObjects, recommendation, clickable);
|
||||
L3D.initBobombScene(scene, collidableObjects, camera, clickable);
|
||||
|
||||
recommendation.resetElements = L3D.resetBobombElements();
|
||||
recommendation.collidableObjects = collidableObjects;
|
||||
camera.resetElements = L3D.resetBobombElements();
|
||||
camera.collidableObjects = collidableObjects;
|
||||
|
||||
recommendation.speed = 0.005;
|
||||
recommendation.reset();
|
||||
recommendation.save();
|
||||
camera.speed = 0.005;
|
||||
camera.reset();
|
||||
camera.save();
|
||||
|
||||
scene.add(recommendation);
|
||||
scene.add(camera);
|
||||
|
||||
Coin.init();
|
||||
var tmp = L3D.createBobombCoins();
|
||||
|
||||
@@ -87,7 +87,15 @@ var ObjectClicker = function(renderer, camera, objects, onHover, onClick, domEle
|
||||
// Add event listeners
|
||||
var self = this;
|
||||
this.domElement.addEventListener('mousemove', function(event) { self.update(event); });
|
||||
this.domElement.addEventListener('click', function(event) { self.click(event); });
|
||||
|
||||
if (navigator.userAgent.indexOf("Firefox") > 0) {
|
||||
// If firefox
|
||||
this.domElement.addEventListener('mousedown', function(event) {self.click(event); });
|
||||
} else {
|
||||
// If chrome
|
||||
this.domElement.addEventListener('click', function(event) { self.click(event); });
|
||||
this.domElement.addEventListener('contextmenu', function(event) { event.button = 2; self.click(event); });
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -120,7 +128,7 @@ ObjectClicker.prototype.getPointedObject = function() {
|
||||
for (var i = 0; i < intersects.length && !intersects[i].object.raycastable; i++){}
|
||||
|
||||
// Objects are sorted by distance in intersects, the best is the first
|
||||
return intersects[i] !== undefined ? intersects[i].object : undefined;
|
||||
return intersects[i];
|
||||
|
||||
};
|
||||
|
||||
@@ -158,9 +166,9 @@ ObjectClicker.prototype.update = function(event) {
|
||||
/**
|
||||
* Calls onClick on the current pointed element
|
||||
*/
|
||||
ObjectClicker.prototype.click = function() {
|
||||
ObjectClicker.prototype.click = function(event) {
|
||||
|
||||
this.onClick(this.currentPointedObject, this.mouse.x, this.mouse.y);
|
||||
this.onClick(this.currentPointedObject, this.mouse.x, this.mouse.y, event);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user