Exemplo n.º 1
0
	void CGrenadeControllerClient::process(const std::shared_ptr<CMessage>& message) {
		if(!_explotionActive) {
			switch( message->getMessageType() ) {
				case Message::CONTACT_ENTER: {
					std::shared_ptr<CMessageContactEnter> contactMsg = std::static_pointer_cast<CMessageContactEnter>(message);
					Logic::TEntityID idPlayerHit = contactMsg->getEntity();
					CEntity * playerHit = CServer::getSingletonPtr()->getMap()->getEntityByID(idPlayerHit);
					
					_explotionActive=true;
					// Si es el escudo del screamer mandar directamente esos daños a la
					// entidad contra la que hemos golpeado (el escudo), sino, crear explosion
					if(playerHit->getType() == "ScreamerShield") {
						// Crear efecto y sonido de absorcion

						// Eliminamos la entidad en diferido
						CEntityFactory::getSingletonPtr()->deferredDeleteEntity(_entity,false);
					}
					else {
						// Eliminamos la entidad en diferido
						CEntityFactory::getSingletonPtr()->deferredDeleteEntity(_entity,false);
						// Creamos la explosion
						createExplotion();
					}
					break;
				}
				case Message::CONTACT_EXIT: {
						std::cout << "CONTACT EXIT DE LA GRANADA, no deberia entrar nunca" << std::endl;
				}
			}
		}
	} // process
Exemplo n.º 2
0
	std::string CPlayerInfo::getPlayerClass() {
		CEntity* entity = CServer::getSingletonPtr()->getMap()->getEntityByID(_entityId);
		assert(entity && "Error: El gestor no puede devolver la clase del jugador porque no se encuentra su id de entidad");
		
		return entity->getType();
	}