1 | package g0803.bindingofshiba.controller.game.events; | |
2 | ||
3 | import g0803.bindingofshiba.App; | |
4 | import g0803.bindingofshiba.bundles.Bundle; | |
5 | import g0803.bindingofshiba.controller.Controller; | |
6 | import g0803.bindingofshiba.events.IEventManager; | |
7 | import g0803.bindingofshiba.events.game.PlayerCollisionWithWallsEvent; | |
8 | import g0803.bindingofshiba.math.BoundingBox; | |
9 | import g0803.bindingofshiba.model.game.Game; | |
10 | import g0803.bindingofshiba.model.game.elements.Player; | |
11 | ||
12 | public class PlayerToWallsCollisionEventsController extends Controller<Game> { | |
13 | ||
14 | public PlayerToWallsCollisionEventsController(Game model, IEventManager eventManager) { | |
15 | super(model, eventManager); | |
16 | } | |
17 | ||
18 | @Override | |
19 | public void tick(App app, double dt) { | |
20 | Bundle<BoundingBox> boundingBoxes = app.getBoundingBoxes(); | |
21 | Player player = getModel().getPlayer(); | |
22 | ||
23 | BoundingBox playerBox = boundingBoxes.get("shiba"); | |
24 | BoundingBox roomBox = boundingBoxes.get("room"); | |
25 | ||
26 | BoundingBox playerBoundingBox = playerBox.translate(player.getNextPosition(dt)); | |
27 |
1
1. tick : negated conditional → KILLED |
if (!roomBox.contains(playerBoundingBox)) |
28 |
1
1. tick : removed call to g0803/bindingofshiba/events/IEventManager::dispatchEvent → KILLED |
getEventManager().dispatchEvent(new PlayerCollisionWithWallsEvent(dt, app, player)); |
29 | } | |
30 | } | |
Mutations | ||
27 |
1.1 |
|
28 |
1.1 |