本文整理汇总了C++中logic::CEntity类的典型用法代码示例。如果您正苦于以下问题:C++ CEntity类的具体用法?C++ CEntity怎么用?C++ CEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activateHealZone
void activateHealZone(unsigned int entityID)
{
Logic::CEntity *entity = Logic::CServer::getSingletonPtr()->getMap()->getEntityByID(entityID);
Logic::MActivateHealZone *m = new Logic::MActivateHealZone();
entity->emitMessage(m);
}
示例2: disconnectionPacketReceived
void CGameServerState::disconnectionPacketReceived(Net::CPaquete* packet) {
// Obtenemos el puntero al gestor de jugadores y el id de red del cliente que se quiere desconectar
Net::NetID playerNetId = packet->getConexion()->getId();
// Eliminamos la entidad manejada por el cliente que se quiere desconectar.
// Para ello comprobamos si tiene asignado un id de entidad. Si no lo tiene, es que
// no ha sido creada ninguna entidad (podria estar conectandose).
if( _playersMgr->existsByNetId(playerNetId) ) {
std::pair<Logic::TEntityID, bool> logicIdPair = _playersMgr->getPlayerId(playerNetId);
if(logicIdPair.second) {
Logic::CEntity* entityToBeDeleted = _map->getEntityByID(logicIdPair.first);
Logic::CEntityFactory::getSingletonPtr()->deferredDeleteEntity(entityToBeDeleted, true);
// A nivel logico, conviene que los clientes sepan quien se desconecta,
// especialmente para eliminar cosas del hud
Net::NetMessageType ackMsg = Net::PLAYER_OFF_MATCH;
Net::CBuffer disconnectMsg;
disconnectMsg.write(&ackMsg, sizeof(ackMsg));
disconnectMsg.write(&playerNetId, sizeof(playerNetId));
disconnectMsg.serialize(entityToBeDeleted->getName(), false);
_netMgr->broadcast(disconnectMsg.getbuffer(), disconnectMsg.getSize());
}
// Eliminamos el jugador que se desconecta del manager de jugadores
_playersMgr->removePlayer(playerNetId);
}
} // disconnexionPacketReceived
示例3: atacarJack
void atacarJack(unsigned int entityID)
{
Logic::CEntity * jack = Logic::CServer::getSingletonPtr()->getMap()->getEntityByID(entityID);
Logic::CEntity* * entidadesColision;
int numColisiones = Physics::CServer::getSingletonPtr()->detectCollisions(jack->getPosition(), 40, entidadesColision);
for(int i = 0; i < numColisiones; ++i)
{
if (!entidadesColision[i]->getTag().compare("enemy"))
{
//Entidad enemiga que atacará a Jack
Logic::CEntity * entidad = entidadesColision[i];
std::stringstream script;
script << "enemyEvent(\"AttackJack\", " << entidad->getEntityID() << ")";
ScriptManager::CServer::getSingletonPtr()->executeScript(script.str().c_str());
Logic::MAttackEntity *message = new Logic::MAttackEntity();
message->setAttack(true);
message->setEntity(jack);
entidad->emitMessage(message);
}
}
}
示例4:
std::pair<CVolumetricLightScattering::ScatteringParams, bool> CVolumetricLightScattering::getClosestLightSource(const std::list<ScatteringParams>& lightList) {
std::pair<ScatteringParams, bool> closestLightSrc;
closestLightSrc.second = false;
// Obtenemos el puntero a la entidad del jugador que en este caso es lo que nos interesa
Logic::CEntity* player = Input::CServer::getSingletonPtr()->getPlayerController()->getControllerAvatar();
if(player != NULL) {
Vector3 playerPosition = player->getPosition();
Vector2 playerPos2d(playerPosition.x, playerPosition.z);
auto it = lightList.begin();
Vector2 pos2d(it->lightPosition.x, it->lightPosition.z);
auto closestLight = it++;
float closestDist = (playerPos2d - pos2d).length();
float dist;
for(; it != lightList.end(); ++it) {
pos2d.x = it->lightPosition.x;
pos2d.y = it->lightPosition.z;
dist = (playerPos2d - pos2d).length();
if(dist < closestDist) {
closestLight = it;
closestDist = dist;
}
}
closestLightSrc.second = true;
closestLightSrc.first = *closestLight;
}
return closestLightSrc;
}
示例5: process
void CSwordSlashController::process(const std::shared_ptr<Logic::IMessage> &message)
{
if((message->getType().compare("TOUCHED") == 0))
{
Logic::CEntity *otherEntity = dynamic_cast<TOUCHED*>(message.get())->getEntidad();
if(otherEntity)
{
if (otherEntity->getTag() == "enemy")
{
if(_damage>0)
{
std::shared_ptr<DAMAGED> m(new DAMAGED());
m->setFloat(_damage);
m->setString(_entity->getType());
otherEntity->emitMessage(m);
std::shared_ptr<PUSH> pushMessage(new PUSH());
pushMessage->setDirection(_direction);
pushMessage->setSpeed(0.5f);
otherEntity->emitMessage(pushMessage, this);
//BaseSubsystems::Log::Debug("ÑAPA: " + std::to_string(_damage));
}
Logic::CEntityFactory::getSingletonPtr()->createEntityByType("ChispaDanhoEnemy",
otherEntity->getCenterPosition(),
_entity->getMap());
}
}
}
} // process
示例6: dataPacketReceived
void CTDMClient::dataPacketReceived(Net::CPaquete* packet) {
CGameClientState::dataPacketReceived(packet);
// Introducimos los datos recibidos en un buffer
Net::CBuffer buffer( packet->getDataLength() );
buffer.write( packet->getData(), packet->getDataLength() );
buffer.reset();
// Obtenemos la cabecera del mensaje
Net::NetMessageType netMsgType;
buffer.read( &netMsgType, sizeof(netMsgType) );
// Dependiendo del tipo de mensaje
switch (netMsgType) {
case Net::END_GAME: {
_inEndGame = true;
// Desactivamos al jugador
Logic::CEntity* player = Input::CServer::getSingletonPtr()->getPlayerController()->getControllerAvatar();
set<string> exceptionList;
exceptionList.insert("CAnimationManager");
player->deactivateAllComponentsExcept(exceptionList);
// Fijamos la cámara en el exterior para que rote a nuestro
// alrededor
Logic::CScoreboard::getSingletonPtr()->activate();
break;
}
}
}
示例7: IntantiateSoulAltar
void IntantiateSoulAltar(Vector3 posDest, Vector3 posInit, Logic::CMap *map)
{
Logic::CEntity *ent = Logic::CEntityFactory::getSingletonPtr()->createEntityByType("AltarFeedback", posInit, map);
Logic::CAltarFeedbackController *comp = (Logic::CAltarFeedbackController *) ent->getComponent("CAltarFeedbackController");
comp->Config(posDest);
}
示例8: empujarCircle
void empujarCircle(unsigned int entityID)
{
Logic::CEntity *entity = Logic::CServer::getSingletonPtr()->getMap()->getEntityByID(entityID);
Logic::MPushEntities *m = new Logic::MPushEntities();
entity->emitMessage(m);
}
示例9: SendMinionCreated
void SendMinionCreated(Logic::CEntity* minionCreated, std::string leaderName)
{
Logic::CEntity* leader = Logic::CServer::getSingletonPtr()->getMap()->getEntityByName(leaderName);
std::shared_ptr<Logic::GET_LOGIC_ENTITY>m(new Logic::GET_LOGIC_ENTITY());
m->setEntity(minionCreated);
leader->emitMessage(m);
}
示例10: cancelCure
void cancelCure(unsigned int entityID)
{
Logic::CEntity *entity = Logic::CServer::getSingletonPtr()->getMap()->getEntityByID(entityID);
Logic::MCureEntity *m = new Logic::MCureEntity();
m->setCure(false);
entity->emitMessage(m);
}
示例11: shakeCamera
void shakeCamera(Logic::CEntity *entity, float max, float min)
{
Logic::CEntity* cam = entity->getMap()->getEntityByType("Camera");
std::shared_ptr<Logic::SHAKE> m(new Logic::SHAKE());
m->setMaxShake(max);
m->setMinShake(min);
cam->emitMessage(m);
}
示例12: detenerEnemigosContraEnemigos
void detenerEnemigosContraEnemigos(unsigned int entityID)
{
//Mandamos un mensaje para que salga el icono de aturdido
Logic::MAturdido *message = new Logic::MAturdido();
message->setAturdido(false);
Logic::CEntity *entity = Logic::CServer::getSingletonPtr()->getMap()->getEntityByID(entityID);
if (entity)
entity->emitMessage(message);
}
示例13: launchFlameThrower
void launchFlameThrower(unsigned int entityID, float point_x, float point_y, float point_z)
{
Logic::CEntity *entity = Logic::CServer::getSingletonPtr()->getMap()->getEntityByID(entityID);
Logic::MLanzarLlamas *m = new Logic::MLanzarLlamas();
m->setPosition(Vector2(point_x, point_z));
m->setOrdenLlamas(Logic::OrdenLlamas::lanzarLlamas);
entity->emitMessage(m);
}
示例14: cancelFlameThrower
void cancelFlameThrower(unsigned int entityID)
{
Logic::CEntity *entity = Logic::CServer::getSingletonPtr()->getMap()->getEntityByID(entityID);
Logic::MLanzarLlamas *m = new Logic::MLanzarLlamas();
m->setPosition(Vector2(0, 0));
m->setOrdenLlamas(Logic::OrdenLlamas::ocultarBLamas);
entity->emitMessage(m);
}
示例15: launchPowerShoot
void launchPowerShoot(unsigned int entityID, float point_x, float point_y, float point_z)
{
Logic::CEntity *entity = Logic::CServer::getSingletonPtr()->getMap()->getEntityByID(entityID);
Logic::MDisparosPotentes *m = new Logic::MDisparosPotentes();
m->setPosition(Vector2(point_x, point_z));
m->setOrdenDisparos(Logic::OrdenDisparos::disparar);
entity->emitMessage(m);
}