moved detector to core

This commit is contained in:
Jeena Paradies 2012-07-21 23:53:33 +02:00
parent b4c59ae7c6
commit 22ae392ace
4 changed files with 58 additions and 27 deletions

View file

@ -8,20 +8,10 @@ function(Box2D, Parent) {
function Detector(me) {
Parent.call(this);
this.me = me;
this.listener = new Box2D.Dynamics.b2ContactListener();
this.listener.chuckDetector = this;
this.listener.BeginContact = this.BeginContact;
this.listener.PostSolve = this.PostSolve;
this.listener.EndContact = this.EndContact;
}
Detector.prototype = Object.create(Parent);
Detector.prototype.getListener = function() {
return this.listener;
}
Detector.prototype.handleStand = function(point, isColliding) {
if (point.GetFixtureA().GetUserData() == Detector.IDENTIFIER.PLAYER_FOOT_SENSOR
|| point.GetFixtureB().GetUserData() == Detector.IDENTIFIER.PLAYER_FOOT_SENSOR) {
@ -30,19 +20,5 @@ function(Box2D, Parent) {
}
}
/** Extension **/
Detector.prototype.BeginContact = function(point) {
this.chuckDetector.handleStand(point, true);
}
Detector.prototype.PostSolve = function(point, impulse) {
this.chuckDetector.handleStand(point, true);
}
Detector.prototype.EndContact = function(point) {
this.chuckDetector.handleStand(point, false);
}
return Detector;
});