diff --git a/src/main/java/cactusServer/models/CollisionManager.java b/src/main/java/cactusServer/models/CollisionManager.java index c3a37c9..a5821c8 100644 --- a/src/main/java/cactusServer/models/CollisionManager.java +++ b/src/main/java/cactusServer/models/CollisionManager.java @@ -44,8 +44,8 @@ for (String instanceId : instances.keySet()) { Instance instance = Instances.getInstance().getInstance(instanceId); instance.getUniverse().update(interval); - collisionPlayersObjects(instanceId, instance); - collisionBulletsAndOthers(instanceId, instance); + collisionPlayersObjects(instanceId, instance); + collisionBulletsAndOthers(instanceId, instance); } } @@ -92,51 +92,54 @@ vec.add(result.normal); object.setPosition(new Position3D(vec)); } - - private void collisionBulletsAndOthers(String instanceId, Instance instance) { - Iterator>> playersBulletsEntryIt = instance.getBullets().entrySet().iterator(); + + private void collisionBulletsAndOthers(String instanceId, Instance instance) { + Iterator>> playersBulletsEntryIt = instance.getBullets().entrySet() + .iterator(); while (playersBulletsEntryIt.hasNext()) { Map.Entry> playersBulletsEntry = playersBulletsEntryIt.next(); String bulletOwnerPlayerId = playersBulletsEntry.getKey(); - Map bulletMap = playersBulletsEntry.getValue(); + Map bulletMap = playersBulletsEntry.getValue(); Iterator> bulletEntryIt = bulletMap.entrySet().iterator(); while (bulletEntryIt.hasNext()) { Map.Entry bulletEntry = bulletEntryIt.next(); String bulletId = bulletEntry.getKey(); Bullet bullet = bulletEntry.getValue(); - boolean isRemoved = collisionBulletAndPlayers(instanceId, instance, bulletOwnerPlayerId, bulletId, bullet, bulletEntryIt); + boolean isRemoved = collisionBulletAndPlayers(instanceId, instance, bulletOwnerPlayerId, bulletId, + bullet, bulletEntryIt); if (!isRemoved) { collisionBulletAndObjects(instance, bulletOwnerPlayerId, bulletId, bullet, bulletEntryIt); } } } - } - private boolean collisionBulletAndPlayers(String instanceId, Instance instance, String bulletOwnerPlayerId, + } + + private boolean collisionBulletAndPlayers(String instanceId, Instance instance, String bulletOwnerPlayerId, String bulletId, Bullet bullet, Iterator> bulletEntryIt) { Instances instances = Instances.getInstance(); for (Map.Entry playersEntry : instances.getPlayers(instanceId).entrySet()) { if (isCollision(bullet, playersEntry.getValue())) { if (!(playersEntry.getKey().equals(bulletOwnerPlayerId))) { // Player(����������)�ƒe�������������̏��������� - } + } // Player(�������܂�)�ɓ��������e������ -// bulletEntryIt.remove(); -// instance.getUniverse().displace(bullet.getPlaceable()); -// System.out.println(bulletId + "�폜"); - return true; + // bulletEntryIt.remove(); + // instance.getUniverse().displace(bullet.getPlaceable()); + // System.out.println(bulletId + "�폜"); + return true; } } return false; } - + private boolean collisionBulletAndObjects(Instance instance, String bulletOwnerPlayerId, String bulletId, - Bullet bullet, Iterator> bulletEntryIt) { + Bullet bullet, Iterator> bulletEntryIt) { for (MovableObject object : instance.getObjects().values()) { - if (isCollision(bullet, object)) { -// bulletEntryIt.remove(); -// instance.getUniverse().displace(bullet.getPlaceable()); -// System.out.println(bulletId + "�폜"); - return true; + if (isCollision(bullet, object)) { + // bulletEntryIt.remove(); + // instance.getUniverse().displace(bullet.getPlaceable()); + // System.out.println(bulletId + "�폜"); + return true; } } return false;