本文整理汇总了C++中Character::GetTeam方法的典型用法代码示例。如果您正苦于以下问题:C++ Character::GetTeam方法的具体用法?C++ Character::GetTeam怎么用?C++ Character::GetTeam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character::GetTeam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: React
bool SpaceMine::React()
{
bool reactFlag = false;
std::map<int, D3DXVECTOR3> targetList;
for ( int i = 0; i < REAL_PLAYER_NUM; ++i )
{
Character* targetCharacter = GObjectTable->GetCharacter( i );
if ( !targetCharacter )
continue;
// 범위 및 현재 거리 계산
D3DXVECTOR4 tempMat;
D3DXVECTOR3 minePosition = GetTransform()->GetPosition(); // ISS 좌표계 기준 좌표
// 현재 위치
D3DXVec3Transform( &tempMat, &minePosition, &m_Matrix );
minePosition = D3DXVECTOR3( tempMat.x, tempMat.y, tempMat.z );
// 일단 각 플레이어와의 거리 확인
D3DXVECTOR3 relativeDirection = minePosition - targetCharacter->GetTransform()->GetPosition();
float distance = D3DXVec3Length( &relativeDirection );
if ( distance <= SPACE_MINE_RANGE )
{
// 범위 안이면 일단 추가
targetList.insert( std::map<int, D3DXVECTOR3>::value_type( i, relativeDirection ) );
// 만약 다른 팀원이면 발동!
if ( m_Team != targetCharacter->GetTeam() )
reactFlag = true;
}
}
// 발동되었다!
// 발동 조건은 상대방 팀에 한정이지만 발동 후 효과 적용은 전체
if ( reactFlag )
{
printf_s( "react!!\n" );
for ( std::map<int, D3DXVECTOR3>::const_iterator it = targetList.begin(); it != targetList.end(); ++it )
{
// 밀려나는 방향 및 세기 결정
D3DXVECTOR3 force;
D3DXVec3Normalize( &force, &it->second );
force *= -SPACE_MINE_FORCE;
// 적용 및 방송
Character* targetCharacter = GObjectTable->GetCharacter( it->first );
assert( targetCharacter );
targetCharacter->Move( force );
targetCharacter->GetClassComponent()->SetMovementControlCooldown( COOLDOWN_STUN );
GObjectTable->GetActorManager()->BroadcastCharacterChange( it->first, ChangeType::KINETIC_STATE );
}
}
return reactFlag;
}
示例2: p_Shoot
bool Syringe::p_Shoot ()
{
Double angle = ActiveCharacter().GetFiringAngle();
Double radius = 0.0;
bool end = false;
JukeBox::GetInstance()->Play ("default","weapon/syringe_shoot");
Character* player = &ActiveCharacter();
do {
// Did we have finished the computation
radius += ONE;
if (cfg().range < radius) {
radius = cfg().range;
end = true;
}
// Compute point coordinates
Point2i relative_pos(static_cast<int>(radius * cos(angle)),
static_cast<int>(radius * sin(angle)) );
Point2i hand_position;
ActiveCharacter().GetHandPosition(hand_position);
Point2i pos_to_check = hand_position + relative_pos;
FOR_ALL_LIVING_CHARACTERS(team, character) {
if (&(*character) != player) {
// Did we touch somebody ?
if (character->Contain(pos_to_check)) {
// Apply damage (*ver).SetEnergyDelta (-cfg().damage);
if (!player->GetTeam().IsSameAs(character->GetTeam()) || !player->IsDiseased())
character->SetDiseaseDamage(player, cfg().damage, cfg().turns);
else {
// The syringe can cure if applied to a teammate!
character->Cure();
}
end = true;
}
}
}
} while (!end);
return true;
}