mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
moved detector to core
This commit is contained in:
parent
b4c59ae7c6
commit
22ae392ace
4 changed files with 58 additions and 27 deletions
|
|
@ -1,6 +1,16 @@
|
|||
define(function() {
|
||||
define([
|
||||
"Lib/Vendor/Box2D",
|
||||
"Game/Core/Collision/Detector"
|
||||
],
|
||||
|
||||
function(Box2D, Parent) {
|
||||
|
||||
function Detector() {
|
||||
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.IDENTIFIER = {
|
||||
|
|
@ -12,6 +22,27 @@ define(function() {
|
|||
PLAYER_FOOT_SENSOR: 'footsensor'
|
||||
}
|
||||
|
||||
return Detector;
|
||||
Detector.prototype.getListener = function() {
|
||||
return this.listener;
|
||||
}
|
||||
|
||||
Detector.prototype.handleStand = function(point, isColliding) {
|
||||
throw "Overwrite this function";
|
||||
}
|
||||
|
||||
/** 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;
|
||||
});
|
||||
|
|
@ -1,4 +1,9 @@
|
|||
define(["Chuck/Physics/Doll", "Chuck/Settings"], function(Doll, Settings){
|
||||
define([
|
||||
"Game/Core/Physics/Doll",
|
||||
"Game/Config/Settings"
|
||||
],
|
||||
|
||||
function(Doll, Settings) {
|
||||
|
||||
function Player (physicsEngine, id, repository) {
|
||||
this.physicsEngine = physicsEngine;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue