2017-11-09 17:03:58 +00:00
|
|
|
// Phaser.Physics.Arcade.Collider
|
|
|
|
|
|
|
|
var Class = require('../../utils/Class');
|
|
|
|
|
|
|
|
var Collider = new Class({
|
|
|
|
|
|
|
|
initialize:
|
|
|
|
|
|
|
|
function Collider (world, overlapOnly, object1, object2, collideCallback, processCallback, callbackContext)
|
|
|
|
{
|
|
|
|
this.world = world;
|
|
|
|
|
2017-11-09 17:10:33 +00:00
|
|
|
this.active = true;
|
|
|
|
|
2017-11-09 17:03:58 +00:00
|
|
|
this.overlapOnly = overlapOnly;
|
|
|
|
|
|
|
|
this.object1 = object1;
|
|
|
|
this.object2 = object2;
|
|
|
|
|
|
|
|
this.collideCallback = collideCallback;
|
|
|
|
this.processCallback = processCallback;
|
|
|
|
this.callbackContext = callbackContext;
|
|
|
|
},
|
|
|
|
|
|
|
|
update: function ()
|
|
|
|
{
|
|
|
|
this.world.collideObjects(
|
|
|
|
this.object1,
|
|
|
|
this.object2,
|
|
|
|
this.collideCallback,
|
|
|
|
this.processCallback,
|
|
|
|
this.callbackContext,
|
|
|
|
this.overlapOnly
|
|
|
|
);
|
2017-11-09 17:10:33 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
destroy: function ()
|
|
|
|
{
|
|
|
|
this.world.removeCollider(this);
|
|
|
|
|
2017-11-09 23:56:28 +00:00
|
|
|
this.active = false;
|
|
|
|
|
2017-11-09 17:10:33 +00:00
|
|
|
this.world = null;
|
|
|
|
|
|
|
|
this.object1 = null;
|
|
|
|
this.object2 = null;
|
|
|
|
|
|
|
|
this.collideCallback = null;
|
|
|
|
this.processCallback = null;
|
|
|
|
this.callbackContext = null;
|
2017-11-09 17:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = Collider;
|