本文整理汇总了C++中Entity::GetOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::GetOrigin方法的具体用法?C++ Entity::GetOrigin怎么用?C++ Entity::GetOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::GetOrigin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Touch
void EntTriggerPush::Touch(Entity &other)
{
// Player *player;
float height, time, dist;
std::stringstream sstr;
if(!target)
return;
Vector3f v = target->GetOrigin() - other.GetOrigin();
height = v[1];
time = (float)sqrt(height / (G_GRAVITY * 0.5));
v[1] = 0;
dist = v.length();
v.normalize();
v *= dist / time;
v[1] = time * G_GRAVITY;
sstr << "push" << " " << v[0] << " " << v[1] << " " << v[2];
if(other.GetClassName() == "player")
{
// logstream() << "TOUCH: " << other.GetOrigin()[0] << " " << other.GetOrigin()[1] << " " << other.GetOrigin()[2] << "\n";
EE.ThrowEvent_i(&other, sstr.str(), 0);
//play sound
EE.C_ExecCommand("s_play basehaste/sound/world/jumppad.wav");
}
}
示例2: OnCollision
void LaserBeam::OnCollision(ICollidable *other)
{
Entity *entity = (Entity*)other;
Damage_t damage;
damage.damage = entity->GetHealth();
if (entity->IsPlayer())
{
damage.damage = 1;
}
damage.direction = Vector2D(-1, 0);
damage.inflictor = GetOwner();
if (GetOwner() != nullptr)
{
damage.statsInflictorName = GetOwner()->GetEntityClassName();
damage.statsInflictorClass = GetOwner()->GetEntityResourceClass();
}
damage.statsWeaponName = GetEntityClassName();
damage.statsWeaponClass = GetEntityResourceClass();
entity->TakeDamage(damage);
Vector2D laserCenter = GetOrigin();
laserCenter.x = entity->GetOrigin().x;
GetGameContext()->GetParticleRoot()->CreateParticles("laser_cannon_hit", laserCenter, Vector2D(-1, 0));
}
示例3: Maintain
void Client::Maintain (const Entity &ent)
{
if (ent.IsPlayer ())
{
m_ent = ent;
m_safeOrigin = ent.GetOrigin ();
m_flags |= ent.IsAlive () ? CLIENT_VALID | CLIENT_ALIVE : CLIENT_VALID;
}
else
{
m_safeOrigin = nullvec;
m_flags = ~(CLIENT_VALID | CLIENT_ALIVE);
}
}
示例4: OnSimulate
void LaserBeam::OnSimulate(float frametime)
{
BaseClass::OnSimulate(frametime);
float laserLength = Camera::GetInstance()->GetWorldMaxs().x - Camera::GetInstance()->GetWorldMins().x;
float gameTime = GetGameContext()->GetGameTime();
SetSize(Vector2D(laserLength, LASER_MAX_SIZE_Y));
Entity *owner = GetOwner();
if (owner == nullptr
|| timer < gameTime)
{
Remove();
}
else
{
Vector2D center = owner->GetOrigin();
center.x -= laserLength * 0.5f;
center += offset;
if (!spawned)
{
Teleport(center);
spawned = true;
}
else
{
SetOrigin(center);
}
}
if (flashTimer < gameTime)
{
flashSize = fixedSize;
fixedSize = qlerp(qfrand(), LASER_MIN_SIZE_Y, LASER_MAX_SIZE_Y);
flashTimer = gameTime + LASER_FLASH_DURATION;
}
}