package cactusServer.models; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.ntlab.radishforandroidstudio.framework.model3D.CollisionResult; import org.ntlab.radishforandroidstudio.framework.model3D.Position3D; import org.ntlab.radishforandroidstudio.framework.physics.PhysicsUtility; import cactusServer.entities.Character; import cactusServer.entities.Instance; import cactusServer.entities.Object; import cactusServer.entities.Player; public class CollisionManager { private static CollisionManager theInstance; private HashMap<String, Instance> instances; private CollisionManager() { instances = Instances.getInstance().getInstances(); } public static CollisionManager getCollision() { if (theInstance == null) { theInstance = new CollisionManager(); } return theInstance; } public void collisionRun(long interval) { for (String instanceId : instances.keySet()) { Instance instance = Instances.getInstance().getInstance(instanceId); instance.getUniverse().update(interval); for (Object object : instance.getObjects().values()) { for (Player player : Instances.getInstance().getPlayers(instanceId).values()) { collisionMove(object, player); } for(Object object2 : instance.getObjects().values()) { if(!object.equals(object2)) { collisionMove(object, object2); } } } } } public void collisionMove(Object object, Player player) { CollisionResult result; result = PhysicsUtility.checkCollision(player.getObject(), "", object.getObject(), ""); if (result != null) { } } public void collisionMove(Object object1,Object object2) { CollisionResult result; result = PhysicsUtility.checkCollision(object1.getObject(), "", object2.getObject(), ""); if (result != null) { } } }