-
-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Make PhysicsComponent vars private, create access methods
- Loading branch information
Showing
3 changed files
with
38 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,20 +34,13 @@ | |
* @author Almas Baimagambetov (AlmasB) ([email protected]) | ||
*/ | ||
public final class PhysicsComponent extends Component { | ||
|
||
FixtureDef fixtureDef = new FixtureDef(); | ||
BodyDef bodyDef = new BodyDef(); | ||
|
||
Body body; | ||
|
||
private List<Entity> groundedList = new ArrayList<>(); | ||
|
||
private ReadOnlyBooleanWrapper onGroundProperty = new ReadOnlyBooleanWrapper(false); | ||
|
||
private FixtureDef fixtureDef = new FixtureDef(); | ||
private BodyDef bodyDef = new BodyDef(); | ||
private Body body; | ||
private final List<Entity> groundedList = new ArrayList<>(); | ||
private final ReadOnlyBooleanWrapper onGroundProperty = new ReadOnlyBooleanWrapper(false); | ||
private boolean raycastIgnored = false; | ||
|
||
private Runnable onInitPhysics = EmptyRunnable.INSTANCE; | ||
|
||
private PhysicsWorld physicsWorld; | ||
|
||
void setWorld(PhysicsWorld world) { | ||
|
@@ -88,6 +81,18 @@ public Body getBody() { | |
return body; | ||
} | ||
|
||
public void setBody(Body body) { | ||
this.body = body; | ||
} | ||
|
||
public FixtureDef getFixtureDef() { | ||
return fixtureDef; | ||
} | ||
|
||
public BodyDef getBodyDef() { | ||
return bodyDef; | ||
} | ||
|
||
/** | ||
* Set a callback to run when this entity has been added to physics world. | ||
* | ||
|
@@ -97,7 +102,7 @@ public void setOnPhysicsInitialized(Runnable code) { | |
onInitPhysics = code; | ||
} | ||
|
||
private Map<HitBox, SensorCollisionHandler> sensorHandlers = new HashMap<>(); | ||
private final Map<HitBox, SensorCollisionHandler> sensorHandlers = new HashMap<>(); | ||
|
||
public Map<HitBox, SensorCollisionHandler> getSensorHandlers() { | ||
return sensorHandlers; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters