本文整理汇总了C++中PlayerData::getPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerData::getPlayer方法的具体用法?C++ PlayerData::getPlayer怎么用?C++ PlayerData::getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerData
的用法示例。
在下文中一共展示了PlayerData::getPlayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
int EnemyMovementObject::update(int dt) {
if(NpcMovementObject::update(dt) == -1) {
return -1;
}
if(noAttackTimer > 0) {
noAttackTimer -= dt;
if(noAttackTimer < 0) {
noAttackTimer = 0;
}
}
if(noAttackTimer == 0) {
Rectangle *thisRect = sprite->getRectWithoutRot();
if(getObjectList() != NULL) {
std::list<GameObject*> *spatialList = spatialHashmap->getNearby(this);
for(std::list<GameObject*>::iterator it = spatialList->begin(); it != spatialList->end(); ++it) {
GameObject *gameObject = *it;
if(gameObject->gameObjectInstance->gameObject->type != GameObjectClass::INIMIGO &&
gameObject->gameObjectInstance->gameObject->type != GameObjectClass::ITEM) {
Rectangle *objectRect = gameObject->sprite->getRectWithoutRot();
if(!gameObject->isInvincible() && gameObject->position->z == 0 && objectRect->intersectsWith(thisRect)) {
int dmg = gameObject->addDamage(this, this->gameObjectInstance->gameObject->atacaEncostaPersonagemDano);
if(dmg != 0) {
gameObject->setInvincibility(1000);
}
}
delete objectRect;
}
}
delete spatialList;
}
delete thisRect;
}
if(attackTimer/1000.0f > (float)this->gameObjectInstance->gameObject->tempoAtaque) {
if(this->gameObjectInstance->gameObject->atiraItemMagiaDirecaoPersonagem) {
ObjectFunctions *objectFunctions = ObjectFunctions::getInstance();
GameData *gameData = GameData::getInstance();
PlayerData *playerData = PlayerData::getInstance();
GameObjectClass *throwed;
throwed = gameData->searchGameObjectById(this->gameObjectInstance->gameObject->atiraItemMagiaDirecaoPersonagemIdItem);
if(playerData->getPlayer() != NULL) {
objectFunctions->throwObject(this, throwed, 2, Vector2(*playerData->getPlayer()->position), 0);
}
}
if(this->gameObjectInstance->gameObject->atiraItemMaginaDirecaoEstiver) {
ObjectFunctions *objectFunctions = ObjectFunctions::getInstance();
GameData *gameData = GameData::getInstance();
GameObjectClass *throwed;
throwed = gameData->searchGameObjectById(this->gameObjectInstance->gameObject->atiraItemMaginaDirecaoEstiverIdItem);
objectFunctions->throwObject(this, throwed, 2, 0);
}
attackTimer = 0;
}
attackTimer += dt;
}