本文整理汇总了C++中TransformComponent::GoToPrevPos方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent::GoToPrevPos方法的具体用法?C++ TransformComponent::GoToPrevPos怎么用?C++ TransformComponent::GoToPrevPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformComponent
的用法示例。
在下文中一共展示了TransformComponent::GoToPrevPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScriptParticle_OnCollision
void Floyd::ScriptParticle_OnCollision(World *world, Entity *owner, const Tile *collider)
{
TransformComponent *ptTransform = owner->GetComponentDirectly<TransformComponent>(CTYPE_TRANSFORM);
StatComponent *ptStat = owner->GetComponentDirectly<StatComponent>(CTYPE_STAT);
ParticleComponent *ptParticle = owner->GetComponentDirectly<ParticleComponent>(CTYPE_PARTICLE);
if ( ! world->GetCurrentLevel()->IsPositionInsideMap(ptTransform->position.PositionAfterMove(ptTransform->direction)))
{
ptStat->health = 0;
}
if (collider->logicalSprite == TILE_WALL || collider->logicalSprite == TILE_MONSTER ||
collider->logicalSprite == TILE_STASH || collider->logicalSprite == TILE_NPC ||
collider->logicalSprite == TILE_TELEPORT || collider->logicalSprite == TILE_DREAMS ||
collider->logicalSprite == TILE_EXIT || collider->logicalSprite == TILE_HERO ||
collider->logicalSprite == TILE_BOSS || collider->logicalSprite == TILE_EXIT_BLOCK)
{
if (collider->sprite == TILE_HERO)
{
world->GetHero()->GetComponentDirectly<StatComponent>(CTYPE_STAT)->ApplyDamage(ptStat->damage);
}
else if ((collider->sprite == TILE_MONSTER || collider->sprite == TILE_BOSS) &&
ptParticle->isEmittedFromHero)
{
auto enemy =
// We predict the particle's position. Therefore, the hit target will be the entity after the particle has
// moved once more.
world->GetEntityAtPos(ptTransform->position.PositionAfterMove(ptTransform->direction));
if (enemy)
{
enemy->GetComponentDirectly<StatComponent>(CTYPE_STAT)->ApplyDamage(ptStat->damage);
}
}
ptStat->health = 0;
ptTransform->GoToPrevPos();
}
}