本文整理汇总了C++中CEntityAlive::Position方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntityAlive::Position方法的具体用法?C++ CEntityAlive::Position怎么用?C++ CEntityAlive::Position使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEntityAlive
的用法示例。
在下文中一共展示了CEntityAlive::Position方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: predicate
bool predicate( CEntityAlive& ea, const SHit& H, MotionID &m, float &angle ) const
{
m = MotionID();
if( H.initiator() != Level().CurrentControlEntity())
return false;
VERIFY( ea.Visual( ) );
IKinematics *K = ea.Visual()->dcast_PKinematics();
VERIFY( K );
if( !is_bone_head( *K, H.bone() ))
return false;
//CAI_Stalker* s = ea.cast_stalker ();
CCharacterPhysicsSupport* chs = ea.character_physics_support();
if( !chs || chs->Type( ) == CCharacterPhysicsSupport::etBitting )
return false;
VERIFY( chs->movement() );
const Fvector stalker_velocity = chs->movement()->GetVelocity();
const float stalker_speed = stalker_velocity.magnitude();
const float min_stalker_speed = 3.65f;
if(stalker_speed < min_stalker_speed )
return false;
const Fvector stalker_velocity_dir = Fvector().mul( stalker_velocity, 1.f/stalker_speed );
const Fvector dir_to_actor = Fvector().sub( H.initiator()->Position(), ea.Position() ).normalize_safe();
const float front_angle_cos = _cos( deg2rad ( 20.f ) );
if( stalker_velocity_dir.dotproduct(dir_to_actor) < front_angle_cos )
return false;
if( type_motion::front != type_motion::dir( ea, H, angle ) )
return false;
Fvector p;
if( Fvector().sub( H.initiator()->Position(), global_hit_position( p, ea, H ) ).magnitude() > 30.f )
return false;
m = motion( front );
type_motion_diagnostic( " type_motion0: 1. = »нерционное движение вперед от попадани¤ в голову ", front, ea, H, m );
return true;
}
示例2: check_attack_jump
//////////////////////////////////////////////////////////////////////////
// Services
//////////////////////////////////////////////////////////////////////////
void CControlManagerCustom::check_attack_jump()
{
if (!m_object->EnemyMan.get_enemy()) return;
if (m_object->GetScriptControl()) return;
if (!m_object->check_start_conditions(ControlCom::eControlJump)) return;
if (!m_object->EnemyMan.see_enemy_now())return;
CEntityAlive *target = const_cast<CEntityAlive*>(m_object->EnemyMan.get_enemy());
if (!m_jump->can_jump(target)) return;
if (m_man->check_start_conditions(ControlCom::eControlJump)) {
m_jump->setup_data().flags.set (SControlJumpData::ePrepareSkip, false);
m_jump->setup_data().target_object = target;
m_jump->setup_data().target_position = target->Position();
jump(m_jump->setup_data());
}
}