void drawBuilding()
{
int baseYSide = 300;
int baseXSide = 760;
CBuilding building;
DefinicaoEstrutura estrutura;
lAllBuilding = mainScript.GetListOfAllAlliedBuildings();
foreach ( Transform predio in lAllBuilding){
building = predio.GetComponent<CBuilding>();
estrutura = predio.GetComponent<DefinicaoEstrutura>();
if (building == null)
continue;
GUI.skin = skin;
if (building.isSelected && building.tipo == CBuilding.TipoEstrutura.CENTRO_COMANDO){
GUI.Label (AddRect(new Rect (baseXSide, baseYSide,BoxCentroComandoTexture.width,BoxCentroComandoTexture.height)), BoxCentroComandoTexture);
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"CENTRAL DE COMANDO");
GUI.Label (new Rect (baseXSide + 10, baseYSide + 10,CentroComandoTexture.width,CentroComandoTexture.height), CentroComandoTexture);
GUI.Label (new Rect (baseXSide + 20, baseYSide + 115,EngenheiroMonkeyTexture.width,EngenheiroMonkeyTexture.height), EngenheiroMonkeyTexture);
GUI.Label (new Rect (baseXSide + 70 , baseYSide + 115,CientistaMonkeyTexture.width,CientistaMonkeyTexture.height), CientistaMonkeyTexture);
GUI.Label (new Rect (baseXSide + 120 , baseYSide + 115 ,SabotadorMonkeyTexture.width,SabotadorMonkeyTexture.height), SabotadorMonkeyTexture);
if (building.TheresAMonkeyInside() != null)
if(GUI.Button(new Rect (baseXSide + 10 , baseYSide + 60 ,SabotadorMonkeyTexture.width,SabotadorMonkeyTexture.height),removerMacaco, "RemoverMacaco")){
Transform monkey = building.TheresAMonkeyInside();
building.GetTheMonkeyOut();
building.Deselect();
mouseWorld.SelectObject(monkey);
}
return;
}
GUI.skin = skin;
if (building.isSelected && building.tipo == CBuilding.TipoEstrutura.EXTRATOR){
GUI.Label (AddRect(new Rect (baseXSide, baseYSide,BoxCentroComandoTexture.width,BoxCentroComandoTexture.height)), BoxCentroComandoTexture);
if (building.resourceSite.GetComponent<CResource>().resourceType == CResource.eResourceType.Metal && building.resourceSite.GetComponent<CResource>().resourceLevel != 0 )
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"EXTRATOR DE METAL");
if (building.resourceSite.GetComponent<CResource>().resourceType == CResource.eResourceType.Metal && building.resourceSite.GetComponent<CResource>().resourceLevel <= 0 )
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"EXTRATOR DE METAL DESATIVADO");
if (building.resourceSite.GetComponent<CResource>().resourceType == CResource.eResourceType.Oxygen && building.resourceSite.GetComponent<CResource>().resourceLevel != 0 )
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"EXTRATOR DE OXIGENIO");
if (building.resourceSite.GetComponent<CResource>().resourceType == CResource.eResourceType.Oxygen && building.resourceSite.GetComponent<CResource>().resourceLevel <= 0 )
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"EXTRATOR DE OXIGENIO DESATIVADO");
GUI.Label (new Rect (baseXSide + 10, baseYSide + 10,ExtratorTexture.width,ExtratorTexture.height), ExtratorTexture);
}
if (building.isSelected && building.tipo == CBuilding.TipoEstrutura.CENTRAL_SEGURANCA){
GUI.Label (AddRect(new Rect (baseXSide, baseYSide,BoxCentroComandoTexture.width,BoxCentroComandoTexture.height)), BoxCentroComandoTexture);
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"CENTRAL DE SEGURANCßA");
GUI.Label (new Rect (baseXSide + 10, baseYSide + 10,SegurancaTexture.width,SegurancaTexture.height), SegurancaTexture);
if(estrutura.statusProgressao == DefinicaoEstrutura.StatusProgresso.EM_ATUALIZACAO){
GUI.DrawTexture(new Rect (baseXSide + 30, baseYSide + 70,(LaboratorioTexture.width + 60) * (estrutura.tempoAtualConstrucao/100),20),BarraProgressoCheia);
GUI.DrawTexture(new Rect (baseXSide + 30, baseYSide + 70,LaboratorioTexture.width + 60,20),MolduraBarraProgresso);
}
else{
if (GUI.Button(new Rect (baseXSide + 30, baseYSide + 70,LaboratorioTexture.width,LaboratorioTexture.height),BtAtualizar,"Atualizar")){
if(!eventosMenu.lastLevel())
if(eventosMenu.canUpgrade())
eventosMenu.AtualizarCentralSeguranca();
}
}
GUI.Label(new Rect (baseXSide+30, baseYSide+150,120,100),"NIVEL: "+estrutura.nivelEstrutura);
}
if (building.isSelected && building.tipo == CBuilding.TipoEstrutura.FAZENDA){
GUI.Label (AddRect(new Rect (baseXSide, baseYSide,BoxCentroComandoTexture.width,BoxCentroComandoTexture.height)), BoxCentroComandoTexture);
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"FAZENDA HIDROPONICA");
GUI.Label (new Rect (baseXSide + 10, baseYSide + 10,FazendaTexture.width,FazendaTexture.height), FazendaTexture);
if(estrutura.statusProgressao == DefinicaoEstrutura.StatusProgresso.EM_ATUALIZACAO){
GUI.DrawTexture(new Rect (baseXSide + 30, baseYSide + 70,(LaboratorioTexture.width + 60) * (estrutura.tempoAtualConstrucao/100),20),BarraProgressoCheia);
GUI.DrawTexture(new Rect (baseXSide + 30, baseYSide + 70,LaboratorioTexture.width + 60,20),MolduraBarraProgresso);
}
else{
if (GUI.Button(new Rect (baseXSide + 30, baseYSide + 70,LaboratorioTexture.width,LaboratorioTexture.height),BtAtualizar,"Atualizar")){
if(!eventosMenu.lastLevel())
if(eventosMenu.canUpgrade())
eventosMenu.AtualizarFazenda();
}
}
GUI.Label(new Rect (baseXSide+30, baseYSide+150,120,100),"NIVEL: "+estrutura.nivelEstrutura);
}
if (building.isSelected && building.tipo == CBuilding.TipoEstrutura.FABRICA_DRONES){
GUI.Label (AddRect(new Rect (baseXSide, baseYSide,BoxCentroComandoTexture.width,BoxCentroComandoTexture.height)), BoxCentroComandoTexture);
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"FABRICA DE DRONES");
GUI.Label (new Rect (baseXSide + 10, baseYSide + 10,FabricaTexture.width,FabricaTexture.height), FabricaTexture);
if(estrutura.statusProgressao == DefinicaoEstrutura.StatusProgresso.EM_PROGRESSO){
GUI.DrawTexture(new Rect (baseXSide + 30, baseYSide + 70,(LaboratorioTexture.width + 60) * (estrutura.tempoAtualConstrucao/100),20),BarraProgressoCheia);
GUI.DrawTexture(new Rect (baseXSide + 30, baseYSide + 70,LaboratorioTexture.width + 60,20),MolduraBarraProgresso);
}
else{
if (GUI.Button(new Rect (baseXSide + 30, baseYSide + 70,LaboratorioTexture.width,LaboratorioTexture.height),(eventosMenu.canDronesabotador()?DroneSabotadorTexture:DroneSabotadorTextureOff),"DroneSabotador")){
if(eventosMenu.canDronesabotador())
eventosMenu.FabricarDroneSabotador();
}
if (GUI.Button(new Rect (baseXSide + 30, baseYSide + 120,SegurancaTexture.width,SegurancaTexture.height), (eventosMenu.canDroneVigia()?DronePatrulhaTexture:DronePatrulhaTextureOff), "DroneVigia")){
if(eventosMenu.canDroneVigia())
eventosMenu.FabricarDroneVigia();
}
if(GUI.Button(new Rect (baseXSide + 90, baseYSide + 70,FazendaTexture.width,FazendaTexture.height),(eventosMenu.canDroneCacador()?DroneCacadorTexture:DroneCacadorTextureOff), "DroneCacador")){
if(eventosMenu.canDroneCacador())
eventosMenu.FabricarDroneCacador();
}
}
/*if(GUI.Button(new Rect (baseXSide + 90, baseYSide + 120,FabricaTexture.width,FabricaTexture.height), "", "DroneCacador")){
eventosMenu.ConstruirFabrica();
}*/
}
if (building.isSelected && building.tipo == CBuilding.TipoEstrutura.LABORATORIO){
GUI.Label (AddRect(new Rect (baseXSide, baseYSide,BoxCentroComandoTexture.width,BoxCentroComandoTexture.height)), BoxCentroComandoTexture);
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"LABORATORIO");
GUI.Label (new Rect (baseXSide + 10, baseYSide + 10,LaboratorioTexture.width,LaboratorioTexture.height), LaboratorioTexture);
}
if (eventosMenu.isSlot() && building.Selectable){
Rect area;
GUI.Label (AddRect(new Rect (baseXSide, baseYSide,BoxSlotTexture.width,BoxSlotTexture.height)), BoxSlotTexture);
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"AREA DE CONSTRUCAO");
GUI.Label (new Rect (baseXSide + 10, baseYSide + 10,SlotTexture.width,SlotTexture.height), SlotTexture);
//Botão do laboratorio
if (GUI.Button(new Rect (baseXSide + 30, baseYSide + 70,LaboratorioTexture.width,LaboratorioTexture.height), (eventosMenu.canLaboratorio()?LaboratorioTexture:LaboratorioTextureOFF),"Laboratorio")){
if(eventosMenu.canLaboratorio())
eventosMenu.ConstruirLaboratorio();
}
area = new Rect (baseXSide + 30, baseYSide + 70,LaboratorioTexture.width,LaboratorioTexture.height);
if(area.Contains(Event.current.mousePosition)){
GUI.Box (new Rect (baseXSide+2, baseYSide+181,BoxMetalTexture.width+12,BoxMetalTexture.height+90),"");
GUI.skin = skin;
GUI.Label(new Rect (baseXSide + 5, baseYSide+182,180,100),"LABORATORIO",style);
GUI.Label(new Rect (baseXSide + 5, baseYSide+208,120,100),"CUSTO");
GUI.Label(new Rect (baseXSide + 70, baseYSide+210,40,20),NivelMetal);
GUI.Label(new Rect (baseXSide + 93, baseYSide+207,120,100),eventosMenu.getDadosLaboratorio("CUSTO"));
GUI.skin = null;
GUI.Label(new Rect (baseXSide + 5, baseYSide+228,175,100),eventosMenu.getDadosLaboratorio("DESCRICAO"));
}
//Botão da central de segurança
if (GUI.Button(new Rect (baseXSide + 30, baseYSide + 120,SegurancaTexture.width,SegurancaTexture.height), (eventosMenu.canSeguranca()?SegurancaTexture:SegurancaTextureOFF),"Seguranca")){
if(eventosMenu.canSeguranca())
eventosMenu.ConstruirCentralSeguranca();
}
area = new Rect (baseXSide + 30, baseYSide + 120,SegurancaTexture.width,SegurancaTexture.height);
if(area.Contains(Event.current.mousePosition)){
GUI.Box (new Rect (baseXSide+2, baseYSide+181,BoxMetalTexture.width+12,BoxMetalTexture.height+90),"");
GUI.skin = skin;
GUI.Label(new Rect (baseXSide + 5, baseYSide+182,180,100),"CENTRAL DE SEGURANCA",style);
GUI.Label(new Rect (baseXSide + 5, baseYSide+208,120,100),"CUSTO");
GUI.Label(new Rect (baseXSide + 70, baseYSide+210,40,20),NivelMetal);
GUI.Label(new Rect (baseXSide + 93, baseYSide+207,120,100),eventosMenu.getDadosCentralSeguranca("CUSTO"));
GUI.skin = null;
GUI.Label(new Rect (baseXSide + 5, baseYSide+228,175,100),eventosMenu.getDadosCentralSeguranca("DESCRICAO"));
}
//Botão da fazenda
if(GUI.Button(new Rect (baseXSide + 90, baseYSide + 70,FazendaTexture.width,FazendaTexture.height), (eventosMenu.canFazenda()?FazendaTexture:FazendaTextureOFF),"Fazenda")){
if(eventosMenu.canFazenda())
eventosMenu.ConstruirFazenda();
}
area = new Rect (baseXSide + 90, baseYSide + 70,FazendaTexture.width,FazendaTexture.height);
if(area.Contains(Event.current.mousePosition)){
GUI.Box (new Rect (baseXSide+2, baseYSide+181,BoxMetalTexture.width+12,BoxMetalTexture.height+90),"");
GUI.skin = skin;
GUI.Label(new Rect (baseXSide + 5, baseYSide+182,180,100),"FAZENDA HIDROPONICA",style);
GUI.Label(new Rect (baseXSide + 5, baseYSide+208,120,100),"CUSTO");
GUI.Label(new Rect (baseXSide + 70, baseYSide+210,40,20),NivelMetal);
GUI.Label(new Rect (baseXSide + 93, baseYSide+207,120,100),eventosMenu.getDadosFazenda("CUSTO"));
GUI.skin = null;
GUI.Label(new Rect (baseXSide + 5, baseYSide+228,175,100),eventosMenu.getDadosFazenda("DESCRICAO"));
}
//Botão da fabrica de drones
if(GUI.Button(new Rect (baseXSide + 90, baseYSide + 120,FabricaTexture.width,FabricaTexture.height), (eventosMenu.canFabrica()?FabricaTexture:FabricaTextureOFF),"Fabrica")){
if(eventosMenu.canFabrica())
eventosMenu.ConstruirFabrica();
}
area = new Rect (baseXSide + 90, baseYSide + 120,FabricaTexture.width,FabricaTexture.height);
if(area.Contains(Event.current.mousePosition)){
GUI.Box (new Rect (baseXSide+2, baseYSide+181,BoxMetalTexture.width+12,BoxMetalTexture.height+90),"");
GUI.skin = skin;
GUI.Label(new Rect (baseXSide + 5, baseYSide+182,180,100),"FABRICA DE DRONES",style);
GUI.Label(new Rect (baseXSide + 5, baseYSide+208,120,100),"CUSTO");
GUI.Label(new Rect (baseXSide + 70, baseYSide+210,40,20),NivelMetal);
GUI.Label(new Rect (baseXSide + 93, baseYSide+207,120,100),eventosMenu.getDadosFabricaDrones("CUSTO"));
GUI.skin = null;
GUI.Label(new Rect (baseXSide + 5, baseYSide+228,175,100),eventosMenu.getDadosFabricaDrones("DESCRICAO"));
}
return;
}
}
lAllResources = mainScript.GetListOfAllNeutralResources();
foreach ( Transform recurso in lAllResources){
CResource r = recurso.GetComponent<CResource>();
if (r.isSelected)
{
GUI.Label (AddRect(new Rect (baseXSide, baseYSide,BoxCentroComandoTexture.width,BoxCentroComandoTexture.height)), BoxCentroComandoTexture);
if (r.resourceType == CResource.eResourceType.Metal){
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"METAL");
GUI.Label (new Rect (baseXSide + 10, baseYSide + 10,MetalTexture.width,MetalTexture.height), MetalTexture);
}
if (r.resourceType == CResource.eResourceType.Oxygen){
GUI.Label(new Rect (baseXSide+70, baseYSide+32,120,100),"FONTE DE H2O");
GUI.Label (new Rect (baseXSide + 10, baseYSide + 10,AguaTexture.width,AguaTexture.height), MetalTexture);
}
if (GUI.Button(new Rect (baseXSide + 40, baseYSide + 80, ExtratorTexture.width,ExtratorTexture.height), (mainScript.CheckIfAreEnoughResourcesToBuild(MainScript.Script.prefabExtractor)?ExtratorTexture:ExtratorTextureOff),"Laboratorio")){
recurso.GetComponent<CBaseEntity>().BuildIt();
}
}
}
}