Newer
Older
CactusServer / src / main / java / cactusServer / models / CollisionManager.java
y-ota on 4 Oct 2018 1 KB totyu
package cactusServer.models;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.ntlab.radishforandroidstudio.framework.model3D.CollisionResult;
import org.ntlab.radishforandroidstudio.framework.physics.PhysicsUtility;

import cactusServer.entities.Character;
import cactusServer.entities.Instance;

public class CollisionManager {
	private static CollisionManager theInstance;
	private List<CollisionResult> result;
	private HashMap<String, Instance> instances;

	private CollisionManager() {
		result = new ArrayList<CollisionResult>();
		instances = Instances.getInstance().getInstances();
	}

	public static CollisionManager getCollision() {
		if (theInstance == null) {
			theInstance = new CollisionManager();
		}
		return theInstance;
	}

	public List<CollisionResult> getResult() {
		return result;
	}

	@SuppressWarnings("unlikely-arg-type")
	public void collisionRun() {
		result.clear();
		for (Map.Entry<String, Instance> instance : instances.entrySet()) {
			HashMap<String, cactusServer.entities.Object> objects = instance.getValue().getObjects();
			HashMap<String,Character> characters = instance.getValue().getCharacters();
			for (Map.Entry<String, cactusServer.entities.Object> object : objects.entrySet()) {
				for (Map.Entry<String, Character> character : characters.entrySet()) {
					result.add(PhysicsUtility.checkCollision(, "",
							instances.get(i).getObjects().get(j).getObject(), ""));
				}
			}
		}
	}

}