#include "Controller.h"

Controller::Controller()
{
	distance_vector location;
	distance_vector current_goal;

	current_goal.x = -60;
	current_goal.y = 77;
	current_goal.z = 54;

	for(int i=0; i < 5; i++)
	{
		location.x = 400+100*i;
		location.y = 130+100*i;
		location.z = 80;
		ArrayOfBasicEntities[i] =  new Jeff();  // <-- Your class name here.
		ArrayOfBasicEntities[i] -> create(location);
		ArrayOfBasicEntities[i] -> set_goal(current_goal);
	}

	for(int i=5; i < 10; i++)
	{
		location.x = 400+100*i;
		location.y = 130+100*i;
		location.z = 80;
		ArrayOfBasicEntities[i] =  new Jeff();  // <-- Your class name here.
		ArrayOfBasicEntities[i] -> create(location);
		ArrayOfBasicEntities[i] -> set_goal(current_goal);

	}

	for(int i=10; i<MAX_NUM_BASIC_ENTITIES; i++)
	{
		location.x = 400+100*i;
		location.y = 130+100*i;
		location.z = 80;
		ArrayOfBasicEntities[i] =  new Gerbil();  // <-- Your class name here.
		ArrayOfBasicEntities[i] -> create(location);
		ArrayOfBasicEntities[i] -> set_goal(current_goal);
	}
}

Controller::~Controller()
{
	for(int i=0; i<MAX_NUM_BASIC_ENTITIES; i++)
		delete ArrayOfBasicEntities[i];
}

void Controller::update()
{

  for(int i=0; i< MAX_NUM_BASIC_ENTITIES; i++)
	{
	ArrayOfBasicEntities[i] -> move();
	}
}  
