本文整理汇总了C++中Projectile::SetGravityMultiplier方法的典型用法代码示例。如果您正苦于以下问题:C++ Projectile::SetGravityMultiplier方法的具体用法?C++ Projectile::SetGravityMultiplier怎么用?C++ Projectile::SetGravityMultiplier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projectile
的用法示例。
在下文中一共展示了Projectile::SetGravityMultiplier方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AttackAnimationTimerFinished
void Player::AttackAnimationTimerFinished()
{
if (IsBow())
{
}
else if (IsBoomerang())
{
vec3 boomerangSpawnPosition = GetCenter() + (m_forward*0.75f) + (GetRightVector()*-0.4f) + (GetUpVector()*0.5f);
float cameraModification = (m_cameraForward.y*17.5f);
if (m_cameraForward.y < 0.0f)
{
cameraModification = (m_cameraForward.y*5.0f);
}
vec3 boomerangTarget = boomerangSpawnPosition + m_forward*15.0f + (vec3(0.0f, 1.0f, 0.0f) * cameraModification);
if (m_pTargetEnemy != NULL)
{
boomerangTarget = m_pTargetEnemy->GetProjectileHitboxCenter();
if (m_pTargetEnemy->IsMoving())
{
boomerangTarget += m_pTargetEnemy->GetForwardVector() * (m_pTargetEnemy->GetMovementSpeed() / 3.0f);
}
}
float curveTime = length(boomerangTarget - boomerangSpawnPosition) / 15.0f;
if (curveTime <= 0.4f)
curveTime = 0.4f;
Projectile* pProjectile = m_pProjectileManager->CreateProjectile(boomerangSpawnPosition, vec3(0.0f, 0.0f, 0.0f), 0.0f, "media/gamedata/weapons/Boomerang/BoomerangThrown.weapon", 0.05f);
pProjectile->SetProjectileType(true, false, false);
pProjectile->SetOwner(this, NULL, NULL);
pProjectile->SetGravityMultiplier(0.0f);
pProjectile->SetReturnToPlayer(true);
pProjectile->SetProjectileCurveParams(m_forward, boomerangTarget, curveTime);
pProjectile->SetWorldCollisionEnabled(true);
m_pVoxelCharacter->SetRenderRightWeapon(false);
}
else if (IsStaff())
{
float powerAmount = 25.0f;
float cameraMultiplier = 25.0f;
vec3 spellSpawnPosition = GetCenter() + (m_forward*1.25f) + (GetUpVector()*0.25f);
if (VoxGame::GetInstance()->GetCameraMode() == CameraMode_FirstPerson)
{
cameraMultiplier = 30.0f;
spellSpawnPosition.y += 0.75f;
}
vec3 spellSpawnVelocity = m_forward * powerAmount + vec3(0.0f, 1.0f, 0.0f) * (m_cameraForward.y*cameraMultiplier);
if (m_pTargetEnemy != NULL)
{
vec3 toTarget = m_pTargetEnemy->GetProjectileHitboxCenter() - GetCenter();
spellSpawnVelocity = (normalize(toTarget) * powerAmount);
}
Projectile* pProjectile = m_pProjectileManager->CreateProjectile(spellSpawnPosition, spellSpawnVelocity, 0.0f, "media/gamedata/items/Fireball/Fireball.item", 0.05f);
pProjectile->SetProjectileType(true, false, false);
pProjectile->SetOwner(this, NULL, NULL);
pProjectile->SetGravityMultiplier(0.0f);
}
else if (IsWand())
{
}
else if (IsBomb())
{
vec3 bombSpawnPosition = GetCenter() + (m_forward*0.75f) + (GetUpVector()*0.5f);
float liftAmount = 8.0f;
float powerAmount = 30.0f;
float cameraMultiplier = 25.0f;
if (VoxGame::GetInstance()->GetCameraMode() == CameraMode_FirstPerson)
{
cameraMultiplier = 30.0f;
}
vec3 bombSpawnVelocity;
if (m_pTargetEnemy)
{
// Enemy target
vec3 toTarget = m_pTargetEnemy->GetCenter() - GetCenter();
float toTargetDistance = length(toTarget);
liftAmount += toTargetDistance * 0.04f;
bombSpawnVelocity = (normalize(toTarget) * powerAmount) + vec3(0.0f, liftAmount, 0.0f);
}
else
{
bombSpawnVelocity = (m_forward * powerAmount) + (GetUpVector() * liftAmount) + vec3(0.0f, 1.0f, 0.0f) * (m_cameraForward.y*cameraMultiplier);
}
Projectile* pProjectile = m_pProjectileManager->CreateProjectile(bombSpawnPosition, bombSpawnVelocity, 0.0f, "media/gamedata/items/Bomb/BombThrown.item", 0.05f);
pProjectile->SetProjectileType(true, false, false);
pProjectile->SetOwner(this, NULL, NULL);
pProjectile->SetGravityMultiplier(3.5f);
float explodeRadius = 3.5f - (GetRandomNumber(-150, 0, 2) * 0.01f);
//.........这里部分代码省略.........
示例2: AttackAnimationTimerFinished_Alternative
void Player::AttackAnimationTimerFinished_Alternative()
{
if (IsBow())
{
}
else if (IsBoomerang())
{
}
else if (IsStaff())
{
}
else if (IsWand())
{
}
else if (IsBomb())
{
}
else if (IsConsumable())
{
}
else if (IsDagger())
{
}
else if (IsHammer())
{
}
else if (IsMace())
{
}
else if (IsSickle())
{
}
else if (IsPickaxe())
{
}
else if (IsAxe())
{
}
else if (Is2HandedSword())
{
}
else if (IsSword())
{
}
else if (IsBlockPlacing())
{
}
else if (IsItemPlacing())
{
}
else if (IsSceneryPlacing())
{
}
else if (IsSpellHands())
{
float powerAmount = 25.0f;
float cameraMultiplier = 25.0f;
vec3 spellSpawnPosition = GetCenter() + (m_forward*0.5f) + (GetUpVector()*0.0f);
// For left hand
spellSpawnPosition += (GetRightVector()*0.4f);
if (VoxGame::GetInstance()->GetCameraMode() == CameraMode_FirstPerson)
{
cameraMultiplier = 30.0f;
spellSpawnPosition.y += 0.75f;
}
vec3 spellSpawnVelocity = m_forward * powerAmount + vec3(0.0f, 1.0f, 0.0f) * (m_cameraForward.y*cameraMultiplier);
if (m_pTargetEnemy != NULL)
{
vec3 toTarget = m_pTargetEnemy->GetProjectileHitboxCenter() - GetCenter();
spellSpawnVelocity = (normalize(toTarget) * powerAmount);
}
Projectile* pProjectile = m_pProjectileManager->CreateProjectile(spellSpawnPosition, spellSpawnVelocity, 0.0f, "media/gamedata/items/Fireball/FireballBlue.item", 0.05f);
pProjectile->SetProjectileType(true, false, false);
pProjectile->SetOwner(this, NULL, NULL);
pProjectile->SetGravityMultiplier(0.0f);
}
else if (IsShield())
{
}
else if (IsTorch())
{
}
}