本文整理汇总了C++中CEntityAlive::character_physics_support方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntityAlive::character_physics_support方法的具体用法?C++ CEntityAlive::character_physics_support怎么用?C++ CEntityAlive::character_physics_support使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEntityAlive
的用法示例。
在下文中一共展示了CEntityAlive::character_physics_support方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: debug_fsm
//.........这里部分代码省略.........
case eStateAttack_Run: sprintf_s(st,"Attack :: Run"); break;
case eStateAttack_Melee: sprintf_s(st,"Attack :: Melee"); break;
case eStateAttack_RunAttack: sprintf_s(st,"Attack :: Run Attack"); break;
case eStateAttack_RunAway: sprintf_s(st,"Attack :: Run Away"); break;
case eStateAttack_FindEnemy: sprintf_s(st,"Attack :: Find Enemy"); break;
case eStateAttack_Steal: sprintf_s(st,"Attack :: Steal"); break;
case eStateAttack_AttackHidden: sprintf_s(st,"Attack :: Attack Hidden"); break;
case eStateAttackCamp_Hide: sprintf_s(st,"Attack Camp:: Hide"); break;
case eStateAttackCamp_Camp: sprintf_s(st,"Attack Camp:: Camp"); break;
case eStateAttackCamp_StealOut: sprintf_s(st,"Attack Camp:: Steal Out"); break;
case eStateAttack_HideInCover: sprintf_s(st,"Attack :: Hide In Cover"); break;
case eStateAttack_MoveOut: sprintf_s(st,"Attack :: Move Out From Cover");break;
case eStateAttack_CampInCover: sprintf_s(st,"Attack :: Camp In Cover"); break;
case eStateAttack_Psy: sprintf_s(st,"Attack :: Psy"); break;
case eStateAttack_MoveToHomePoint: sprintf_s(st,"Attack :: Move To Home Point"); break;
case eStateAttack_HomePoint_Hide: sprintf_s(st,"Attack :: Home Point :: Hide"); break;
case eStateAttack_HomePoint_Camp: sprintf_s(st,"Attack :: Home Point :: Camp"); break;
case eStateAttack_HomePoint_LookOpenPlace: sprintf_s(st,"Attack :: Home Point :: Look Open Place"); break;
case eStatePanic_Run: sprintf_s(st,"Panic :: Run Away"); break;
case eStatePanic_FaceUnprotectedArea: sprintf_s(st,"Panic :: Face Unprotected Area"); break;
case eStatePanic_HomePoint_Hide: sprintf_s(st,"Panic :: Home Point :: Hide"); break;
case eStatePanic_HomePoint_LookOpenPlace: sprintf_s(st,"Panic :: Home Point :: Look Open Place"); break;
case eStatePanic_HomePoint_Camp: sprintf_s(st,"Panic :: Home Point :: Camp"); break;
case eStateHitted_Hide: sprintf_s(st,"Hitted :: Hide"); break;
case eStateHitted_MoveOut: sprintf_s(st,"Hitted :: MoveOut"); break;
case eStateHitted_Home: sprintf_s(st,"Hitted :: Home"); break;
case eStateHearDangerousSound_Hide: sprintf_s(st,"Dangerous Snd :: Hide"); break;
case eStateHearDangerousSound_FaceOpenPlace: sprintf_s(st,"Dangerous Snd :: FaceOpenPlace"); break;
case eStateHearDangerousSound_StandScared: sprintf_s(st,"Dangerous Snd :: StandScared"); break;
case eStateHearDangerousSound_Home: sprintf_s(st,"Dangerous Snd :: Home"); break;
case eStateHearInterestingSound_MoveToDest: sprintf_s(st,"Interesting Snd :: MoveToDest"); break;
case eStateHearInterestingSound_LookAround: sprintf_s(st,"Interesting Snd :: LookAround"); break;
case eStateHearHelpSound: sprintf_s(st,"Hear Help Sound"); break;
case eStateHearHelpSound_MoveToDest: sprintf_s(st,"Hear Help Sound :: MoveToDest"); break;
case eStateHearHelpSound_LookAround: sprintf_s(st,"Hear Help Sound :: LookAround"); break;
case eStateControlled_Follow_Wait: sprintf_s(st,"Controlled :: Follow : Wait"); break;
case eStateControlled_Follow_WalkToObject: sprintf_s(st,"Controlled :: Follow : WalkToObject"); break;
case eStateControlled_Attack: sprintf_s(st,"Controlled :: Attack"); break;
case eStateThreaten: sprintf_s(st,"Threaten :: "); break;
case eStateFindEnemy_Run: sprintf_s(st,"Find Enemy :: Run"); break;
case eStateFindEnemy_LookAround_MoveToPoint: sprintf_s(st,"Find Enemy :: Look Around : Move To Point"); break;
case eStateFindEnemy_LookAround_LookAround: sprintf_s(st,"Find Enemy :: Look Around : Look Around"); break;
case eStateFindEnemy_LookAround_TurnToPoint: sprintf_s(st,"Find Enemy :: Look Around : Turn To Point"); break;
case eStateFindEnemy_Angry: sprintf_s(st,"Find Enemy :: Angry"); break;
case eStateFindEnemy_WalkAround: sprintf_s(st,"Find Enemy :: Walk Around"); break;
case eStateSquad_Rest_Idle: sprintf_s(st,"Squad :: Rest : Idle"); break;
case eStateSquad_Rest_WalkAroundLeader: sprintf_s(st,"Squad :: Rest : WalkAroundLeader"); break;
case eStateSquad_RestFollow_Idle: sprintf_s(st,"Squad :: Follow Leader : Idle"); break;
case eStateSquad_RestFollow_WalkToPoint: sprintf_s(st,"Squad :: Follow Leader : WalkToPoint"); break;
case eStateCustom_Vampire: sprintf_s(st,"Attack :: Vampire"); break;
case eStateVampire_ApproachEnemy: sprintf_s(st,"Vampire :: Approach to enemy"); break;
case eStateVampire_Execute: sprintf_s(st,"Vampire :: Hit"); break;
case eStateVampire_RunAway: sprintf_s(st,"Vampire :: Run Away"); break;
case eStateVampire_Hide: sprintf_s(st,"Vampire :: Hide"); break;
case eStatePredator: sprintf_s(st,"Predator"); break;
case eStatePredator_MoveToCover: sprintf_s(st,"Predator :: MoveToCover"); break;
case eStatePredator_LookOpenPlace: sprintf_s(st,"Predator :: Look Open Place"); break;
case eStatePredator_Camp: sprintf_s(st,"Predator :: Camp"); break;
case eStateBurerAttack_Tele: sprintf_s(st,"Attack :: Telekinesis"); break;
case eStateBurerAttack_Gravi: sprintf_s(st,"Attack :: Gravi Wave"); break;
case eStateBurerAttack_RunAround: sprintf_s(st,"Attack :: Run Around"); break;
case eStateBurerAttack_FaceEnemy: sprintf_s(st,"Attack :: Face Enemy"); break;
case eStateBurerAttack_Melee: sprintf_s(st,"Attack :: Melee"); break;
case eStateBurerScanning: sprintf_s(st,"Attack :: Scanning"); break;
case eStateCustomMoveToRestrictor: sprintf_s(st,"Moving To Restrictor :: Position not accessible"); break;
case eStateSmartTerrainTask: sprintf_s(st,"ALIFE"); break;
case eStateSmartTerrainTaskGamePathWalk: sprintf_s(st,"ALIFE :: Game Path Walk"); break;
case eStateSmartTerrainTaskLevelPathWalk: sprintf_s(st,"ALIFE :: Level Path Walk"); break;
case eStateSmartTerrainTaskWaitCapture: sprintf_s(st,"ALIFE :: Wait till smart terrain will capture me"); break;
case eStateUnknown: sprintf_s(st,"Unknown State :: "); break;
default: sprintf_s(st,"Undefined State ::"); break;
}
DBG().object_info(this,this).remove_item (u32(0));
DBG().object_info(this,this).remove_item (u32(1));
DBG().object_info(this,this).remove_item (u32(2));
DBG().object_info(this,this).add_item (*cName(), D3DCOLOR_XRGB(255,0,0), 0);
DBG().object_info(this,this).add_item (st, D3DCOLOR_XRGB(255,0,0), 1);
sprintf_s(st, "Team[%u]Squad[%u]Group[%u]", g_Team(), g_Squad(), g_Group());
DBG().object_info(this,this).add_item (st, D3DCOLOR_XRGB(255,0,0), 2);
CEntityAlive *entity = smart_cast<CEntityAlive *>(Level().CurrentEntity());
if (entity && entity->character_physics_support()->movement()) {
sprintf_s(st,"VELOCITY [%f,%f,%f] Value[%f]",VPUSH(entity->character_physics_support()->movement()->GetVelocity()),entity->character_physics_support()->movement()->GetVelocityActual());
DBG().text(this).clear();
DBG().text(this).add_item(st,200,100,COLOR_GREEN,100);
}
}
示例3: conditions
//.........这里部分代码省略.........
//-----------------------------------------------
// Animations
//-----------------------------------------------
TextTree& controller_s = root_s.find_or_add("Controllers");
TextTree& animation_s = controller_s.find_or_add("Animations");
TextTree& current_animation_s = animation_s.add_line(*anim().cur_anim_info().name);
CBlend* p_blend = control().animation().current_blend();
if ( !p_blend )
{
p_blend = anim().cur_anim_info().blend;
}
if ( p_blend )
{
detail::add_debug_info(current_animation_s, p_blend);
current_animation_s.add_line("Script_Animation?", p_blend->motionID == m_tpScriptAnimation);
}
else
{
current_animation_s.add_text("0");
}
//-----------------------------------------------
// Movement
//-----------------------------------------------
TextTree& movement_s = controller_s.find_or_add("Movement");
movement_s.add_line("Actual", control().path_builder().actual());
movement_s.add_line("Enabled", control().path_builder().enabled());
CEntityAlive *entity = smart_cast<CEntityAlive *>(Level().CurrentEntity());
if ( entity && entity->character_physics_support()->movement() )
{
movement_s.add_line("Velocity", entity->character_physics_support()->movement()->GetVelocityActual());
}
movement_s.add_line("Position").add_line(Position());
movement_s.add_line("Level_Vertex_ID", ai_location().level_vertex_id());
movement_s.add_line("Game_Vertex_ID", ai_location().game_vertex_id());
detail::add_debug_info(movement_s.add_line("Orientation_Current"),
movement().body_orientation().current);
detail::add_debug_info(movement_s.add_line("Orientation_Target"),
movement().body_orientation().target);
movement_s.add_line("Rotation_Speed", movement().body_orientation().speed);
const char* pc_path_type = "undefined";
switch ( movement().path_type() )
{
case MovementManager::ePathTypePatrolPath: pc_path_type = "Patrol_Path"; break;
case MovementManager::ePathTypeGamePath: pc_path_type = "Game_Path"; break;
case MovementManager::ePathTypeLevelPath: pc_path_type = "Level_Path"; break;
}
movement_s.add_line("Path_Type", pc_path_type);
if ( movement().path_type() == MovementManager::ePathTypePatrolPath )
{
movement_s.add_line("Path_Name", *movement().patrol().path_name());
movement_s.add_line("Completed", movement().patrol().completed());
movement_s.add_line("Current_Point", movement().patrol().get_current_point_index());
if ( movement().patrol().get_path() &&
movement().patrol().get_path()->vertex(movement().patrol().get_current_point_index()) )
{
示例4: GraviStrike
void CBlackGraviArtefact::GraviStrike()
{
xr_list<s16> elements_list;
xr_list<Fvector> bone_position_list;
Fvector object_pos ;
Fvector strike_dir ;
rq_storage.r_clear ();
for(GAME_OBJECT_LIST_it it = m_GameObjectList.begin();
m_GameObjectList.end() != it;
++it)
{
CPhysicsShellHolder* pGameObject = *it;
if(pGameObject->Visual())
pGameObject->Center(object_pos);
else
object_pos.set(pGameObject->Position());
strike_dir.sub(object_pos, Position());
float distance = strike_dir.magnitude();
float impulse = 100.f*m_fStrikeImpulse * (1.f - (distance/m_fRadius)*
(distance/m_fRadius));
if(impulse > .001f)
{
//? BOOL enabled = getEnabled();
//? setEnabled (FALSE);
impulse *= CExplosive::ExplosionEffect (rq_storage,NULL,pGameObject, Position(),m_fRadius);
//? setEnabled (enabled);
}
float hit_power ;
CEntityAlive* pEntityAlive = smart_cast<CEntityAlive*>(pGameObject);
if(pGameObject->m_pPhysicsShell) hit_power = 0;
else if(pEntityAlive && pEntityAlive->g_Alive() &&
pEntityAlive->character_physics_support()->movement()->CharacterExist())
hit_power = 0;
else
hit_power = impulse;
if(impulse > .001f)
{
while(!elements_list.empty())
{
s16 element = elements_list.front();
Fvector bone_pos = bone_position_list.front();
NET_Packet P;
SHit HS;
HS.GenHeader(GE_HIT, pGameObject->ID()); // u_EventGen (P,GE_HIT, pGameObject->ID());
HS.whoID =ID(); // P.w_u16 (ID());
HS.weaponID = ID(); // P.w_u16 (ID());
HS.dir = strike_dir; // P.w_dir (strike_dir);
HS.power = hit_power; // P.w_float (hit_power);
HS.boneID = element; // P.w_s16 (element);
HS.p_in_bone_space = bone_pos; // P.w_vec3 (bone_pos);
HS.impulse = impulse; // P.w_float (impulse);
HS.hit_type = (ALife::eHitTypeWound); // P.w_u16 (u16(ALife::eHitTypeWound));
HS.Write_Packet(P);
u_EventSend (P);
elements_list.pop_front();
bone_position_list.pop_front();
}
}
}
}