mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
restructuring repository
This commit is contained in:
parent
080a2e410c
commit
bcde1d3171
36 changed files with 2 additions and 2 deletions
33
game-draft/js/Chuck/Collision/Detector.js
Executable file
33
game-draft/js/Chuck/Collision/Detector.js
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
Chuck.Collision.Detector = function(me) { //extends b2ContactListener {
|
||||
this._me = me;
|
||||
|
||||
this._listener = new Chuck.b2ContactListener();
|
||||
this._listener._chuckDetector = this;
|
||||
this._listener.BeginContact = this.BeginContact;
|
||||
this._listener.PostSolve = this.PostSolve;
|
||||
this._listener.EndContact = this.EndContact;
|
||||
}
|
||||
|
||||
Chuck.Collision.Detector.prototype.getListener = function() {
|
||||
return this._listener;
|
||||
}
|
||||
|
||||
Chuck.Collision.Detector.prototype.handleStand = function(point, isColliding) {
|
||||
if (point.GetFixtureA().GetUserData() == 'myFeet' || point.GetFixtureB().GetUserData() == 'myFeet') {
|
||||
this._me.onFootSensorDetection(isColliding);
|
||||
}
|
||||
}
|
||||
|
||||
/** Extension **/
|
||||
|
||||
Chuck.Collision.Detector.prototype.BeginContact = function(point) {
|
||||
this._chuckDetector.handleStand(point, true);
|
||||
}
|
||||
|
||||
Chuck.Collision.Detector.prototype.PostSolve = function(point, impulse) {
|
||||
this._chuckDetector.handleStand(point, true);
|
||||
}
|
||||
|
||||
Chuck.Collision.Detector.prototype.EndContact = function(point) {
|
||||
this._chuckDetector.handleStand(point, false);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue