Ejemplo n.º 1
0
Entity* MicroAspect::getEnemyAttackingThisUnit(std::set<Entity*> &enemies){
	for(set<Entity*>::iterator i = enemies.begin(); i!= enemies.end();i++){
		Weapon* weapon = static_cast<Weapon*>((*i)->getAspect(WEAPON));
		if(weapon->getTarget()->entity == this->unit){
			return *i;
		}
	}
	return NULL;
}
Ejemplo n.º 2
0
bool MicroAspect::isBeingTarget(Entity* u, std::set<Entity*> &enemies){
	for(set<Entity*>::iterator i = enemies.begin(); i!= enemies.end();i++){
		Weapon* weapon = static_cast<Weapon*>((*i)->getAspect(WEAPON));
		if(weapon->getTarget()->entity == this->unit){
			return true;
		}
	}
	return false;
}
Ejemplo n.º 3
0
//return
int MicroAspect::getNumberOfAttackers(Entity* u){
	int count = 0;
	set<Entity*> units = this->squad->getSquadUnits();

	for (set<Entity*>::iterator i = units.begin();i!= units.end();i++){
		Weapon* weapon = static_cast<Weapon*>((*i)->getAspect(WEAPON));
		if(weapon->getTarget()->entity == u){
			count ++;
		}
	}

	return count;
}