package world;

import java.util.ArrayList;

import javax.media.opengl.GL;
import javax.media.opengl.glu.GLU;

import com.sun.opengl.util.GLUT;

import eng.Data;
import eng.Input;

public class GameObject {
	
	protected GLU glu;
	protected GLUT glut;
	
	protected Camera camera;
	protected Input input;
	protected Data data;
	
	protected boolean exists;
	
	protected boolean scenePaused;
	protected boolean sceneEnded;
	
	protected String triggeredGameState;
	
	protected ArrayList<GameObject> spawn;
	
	public GameObject() {
		
		exists = true;
		
		spawn = new ArrayList<GameObject>();
	}
	
	public void setGLUtilities(GLU glu, GLUT glut) {
		this.glu = glu;
		this.glut = glut;
	}
	
	public void update() {
		
	}
	
	public void setCamera(Camera camera) {
		this.camera = camera;
	}
	
	public Camera getCamera() {
		return camera;
	}
	
	public void setInput(Input input) {
		this.input = input;
	}
	
	public void setData(Data data) {
		this.data = data;
	}
	
	public Data getData() {
		return data;
	}
	
	public void render(GL gl) {
		
	}
	
	public void interact(GameObject object) {
		
	}
	
	public void inspectScene(ArrayList<GameObject> objects) {
		
	}
	
	protected ArrayList<GameObject> getSpawn() {
		
		ArrayList<GameObject> getSpawn = new ArrayList<GameObject>();
		
		for(int i = 0; i < spawn.size(); i++)
			getSpawn.add(spawn.remove(0));
		
		return getSpawn;
	}
	
	public boolean doesExist() {
		return exists;
	}
	
	public void destroy() {
		exists = false;
	}
	
	public void setTriggeredGameState(String triggeredGameState) {
		this.triggeredGameState = triggeredGameState;
	}
	
	public String getTriggeredGameState() {
		return triggeredGameState;
	}
	
	public void pauseScene() {
		scenePaused = true;
	}
	
	public void endScene() {
		sceneEnded = true;
	}
	
	public boolean isScenePaused() {
		
		if(scenePaused) {
			
			scenePaused = false;
			
			return true;
		}
		
		return false;
	}
	
	public boolean isSceneEnded() {
		return sceneEnded;
	}
	
	public void onPause() {
		
	}
	
	public void onEnd() {
		
	}
}