int quienQueda()
{
int sumaE1, sumaH;
sumaE1 = sumaH = 0;
GameObject[] games;
games = GameObject.FindGameObjectsWithTag("civil");
foreach(var civil in games){ //Miro todos los Unit y si hay alguno de owner lo sumo
if(civil.GetComponent<CivilUnit>().owner.human){
sumaH += 1;
}
else{
sumaE1 += 1;
}
}
games = GameObject.FindGameObjectsWithTag("mility");
foreach(var mility in games){ //Miro todos los TownCenterBuilding y si hay alguno de owner lo sumo
if(mility.GetComponent<Unit>().owner.human){
sumaH += 1;
}
else{
sumaE1 += 1;
}
}
games = GameObject.FindGameObjectsWithTag("townCenter");
foreach(var town in games){ //Miro todos los TownCenterBuilding y si hay alguno de owner lo sumo
if(town.GetComponent<TownCenterBuilding>().owner.human){
sumaH += 1;
}
else{
sumaE1 += 1;
}
}
games = GameObject.FindGameObjectsWithTag("armyBuilding");
foreach(var army in games){ //Miro todos los TownCenterBuilding y si hay alguno de owner lo sumo
if(army.GetComponent<ArmyBuilding>().owner.human){
sumaH += 1;
}
else{
sumaE1 += 1;
}
}
games = GameObject.FindGameObjectsWithTag("academy");
foreach(var aca in games){ //Miro todos los TownCenterBuilding y si hay alguno de owner lo sumo
if(aca.GetComponent<Academy>().owner.human){
sumaH += 1;
}
else{
sumaE1 += 1;
}
}
if(sumaE1 == 0){ //Si no e sumado ningun enemigo HE GANADO
return 1;
}
else if(sumaH == 0){ //Si no he sumado ningun "humano", HAS PERDIDO
return 2;
}
return 0; // NADA
}