本文整理汇总了C++中IsMoving函数的典型用法代码示例。如果您正苦于以下问题:C++ IsMoving函数的具体用法?C++ IsMoving怎么用?C++ IsMoving使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsMoving函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: return
int CNPC_Bullsquid::RangeAttack1Conditions( float flDot, float flDist )
{
if ( IsMoving() && flDist >= 512 )
{
// squid will far too far behind if he stops running to spit at this distance from the enemy.
return ( COND_NONE );
}
if ( flDist > 85 && flDist <= 784 && flDot >= 0.5 && gpGlobals->curtime >= m_flNextSpitTime )
{
if ( GetEnemy() != NULL )
{
if ( fabs( GetAbsOrigin().z - GetEnemy()->GetAbsOrigin().z ) > 256 )
{
// don't try to spit at someone up really high or down really low.
return( COND_NONE );
}
}
if ( IsMoving() )
{
// don't spit again for a long time, resume chasing enemy.
m_flNextSpitTime = gpGlobals->curtime + 5;
}
else
{
// not moving, so spit again pretty soon.
m_flNextSpitTime = gpGlobals->curtime + 0.5;
}
return( COND_CAN_RANGE_ATTACK1 );
}
return( COND_NONE );
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:35,代码来源:hl1_npc_bullsquid.cpp
示例2: CheckRangeAttack1
//=========================================================
// CheckRangeAttack1
//=========================================================
BOOL CBullsquid :: CheckRangeAttack1 ( float flDot, float flDist )
{
if ( IsMoving() && flDist >= 512 )
{
// squid will far too far behind if he stops running to spit at this distance from the enemy.
return FALSE;
}
if ( flDist > 64 && flDist <= 784 && flDot >= 0.5 && gpGlobals->time >= m_flNextSpitTime )
{
if ( m_hEnemy != NULL )
{
if ( fabs( pev->origin.z - m_hEnemy->pev->origin.z ) > 256 )
{
// don't try to spit at someone up really high or down really low.
return FALSE;
}
}
if ( IsMoving() )
{
// don't spit again for a long time, resume chasing enemy.
m_flNextSpitTime = gpGlobals->time + 5;
}
else
{
// not moving, so spit again pretty soon.
m_flNextSpitTime = gpGlobals->time + 0.5;
}
return TRUE;
}
return FALSE;
}
开发者ID:Xash3DLinux,项目名称:xash3dlinux,代码行数:38,代码来源:bullsquid.cpp
示例3: IsMoving
// Update
void Game_Player::Update() {
bool last_moving = IsMoving();
if (!IsMoving() && !Game_Map::GetInterpreter().IsRunning()
/*move_route_forcing || Game_Temp::message_window_showing*/) {
switch (Input::dir4) {
case 2:
MoveDown();
break;
case 4:
MoveLeft();
break;
case 6:
MoveRight();
break;
case 8:
MoveUp();
}
}
int last_real_x = real_x;
int last_real_y = real_y;
Game_Character::Update();
UpdateScroll(last_real_x, last_real_y);
UpdateNonMoving(last_moving);
}
开发者ID:Bonstra,项目名称:EasyRPG-Player,代码行数:30,代码来源:game_player.cpp
示例4: SetSpriteName
void Game_Event::Setup(RPG::EventPage* new_page) {
bool from_null = page == NULL;
page = new_page;
// Free resources if needed
if (interpreter) {
// If the new page is null and the interpreter is running, it should
// carry on executing its command list during this frame
if (page)
interpreter->Clear();
Game_Map::ReserveInterpreterDeletion(interpreter);
interpreter.reset();
}
if (page == NULL) {
tile_id = 0;
SetSpriteName("");
SetSpriteIndex(0);
SetDirection(RPG::EventPage::Direction_down);
//move_type = 0;
trigger = -1;
list.clear();
return;
}
SetSpriteName(page->character_name);
SetSpriteIndex(page->character_index);
tile_id = page->character_name.empty() ? page->character_index : 0;
if (original_pattern != page->character_pattern) {
pattern = page->character_pattern;
original_pattern = pattern;
}
move_type = page->move_type;
SetMoveSpeed(page->move_speed);
SetMoveFrequency(page->move_frequency);
max_stop_count = (GetMoveFrequency() > 7) ? 0 : (int)pow(2.0, 8 - GetMoveFrequency());
original_move_frequency = page->move_frequency;
original_move_route = page->move_route;
SetOriginalMoveRouteIndex(0);
bool last_direction_fixed = IsDirectionFixed() || IsFacingLocked();
animation_type = page->animation_type;
if (from_null || !(last_direction_fixed || IsMoving()) || IsDirectionFixed())
SetSpriteDirection(page->character_direction);
if (!IsMoving())
SetDirection(page->character_direction);
SetOpacity(page->translucent ? 160 : 255);
SetLayer(page->layer);
data.overlap_forbidden = page->overlap_forbidden;
trigger = page->trigger;
list = page->event_commands;
if (trigger == RPG::EventPage::Trigger_parallel) {
interpreter.reset(new Game_Interpreter_Map());
}
}
开发者ID:Souigetsu,项目名称:Player,代码行数:60,代码来源:game_event.cpp
示例5: IsMoving
void Game_Player::Update() {
bool last_moving = IsMoving();
if (!IsMoving() && !Game_Map::GetInterpreter().IsRunning()
&& !IsMoveRouteOverwritten() && !Game_Message::message_waiting) {
switch (Input::dir4) {
case 2:
MoveDown();
break;
case 4:
MoveLeft();
break;
case 6:
MoveRight();
break;
case 8:
MoveUp();
}
}
int last_real_x = real_x;
int last_real_y = real_y;
Game_Character::Update();
UpdateScroll(last_real_x, last_real_y);
UpdateNonMoving(last_moving);
}
开发者ID:MarianoGnu,项目名称:Player,代码行数:29,代码来源:game_player.cpp
示例6: TakeDamage
//=========================================================
// TakeDamage - overridden for bullsquid so we can keep track
// of how much time has passed since it was last injured
//=========================================================
int CBullsquid :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
float flDist;
Vector vecApex;
// if the squid is running, has an enemy, was hurt by the enemy, hasn't been hurt in the last 3 seconds, and isn't too close to the enemy,
// it will swerve. (whew).
if ( m_hEnemy != NULL && IsMoving() && pevAttacker == m_hEnemy->pev && gpGlobals->time - m_flLastHurtTime > 3 )
{
flDist = ( pev->origin - m_hEnemy->pev->origin ).Length2D();
if ( flDist > SQUID_SPRINT_DIST )
{
flDist = ( pev->origin - m_Route[ m_iRouteIndex ].vecLocation ).Length2D();// reusing flDist.
if ( FTriangulate( pev->origin, m_Route[ m_iRouteIndex ].vecLocation, flDist * 0.5, m_hEnemy, &vecApex ) )
{
InsertWaypoint( vecApex, bits_MF_TO_DETOUR | bits_MF_DONT_SIMPLIFY );
}
}
}
if ( !FClassnameIs ( pevAttacker, "monster_headcrab" ) )
{
// don't forget about headcrabs if it was a headcrab that hurt the squid.
m_flLastHurtTime = gpGlobals->time;
}
return CBaseMonster :: TakeDamage ( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
开发者ID:Xash3DLinux,项目名称:xash3dlinux,代码行数:34,代码来源:bullsquid.cpp
示例7: WriteToPacket
// ------------------------------------------------------------------------------------------------
Uint32 ProjectileBase :: WriteToPacket(Uint32 dataWritePos, Uint8 data[])
{
Uint32 sendId = Id();
ProjectileType sendType = Type();
Vector2df sendPos = Pos();
Uint32 sendHeadingDeg = HeadingDeg();
float sendSpeed = Speed();
Uint32 sendOwnerPlayerId = OwnerPlayerId();
float sendLife = Life();
Uint32 sendHealth = Health();
bool sendIsMoving = IsMoving();
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_ID], &sendId, 4);
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_TYPE], &sendType, 4);
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_POSX], &sendPos.x, 4);
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_POSY], &sendPos.y, 4);
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_HEADING], &sendHeadingDeg, 4);
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_SPEED], &sendSpeed, 4);
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_LIFE], &sendLife, 4);
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_HEALTH], &sendHealth, 4);
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_PLAYER_ID], &sendOwnerPlayerId, 4);
memcpy(&data[dataWritePos + PACKET_WRITE_PROJECTILE_ISMOVING], &sendIsMoving, 1);
return PACKET_WRITE_PROJECTILE_LENGTH;
} // ----------------------------------------------------------------------------------------------
开发者ID:JustinWang123,项目名称:Gravity,代码行数:26,代码来源:ProjectileBase.cpp
示例8: if
void SmoothFollowProcess::VUpdate(unsigned int elapsedTime)
{
float diffX = m_posX - m_pImage->GetPosX();
float diffY = m_posY - m_pImage->GetPosY();
float deltaX = diffX*m_speed*elapsedTime;
float deltaY = diffY*m_speed*elapsedTime;
if(fabs(deltaX) > fabs(diffX))
deltaX = diffX;
if(fabs(deltaY) > fabs(diffY))
deltaY = diffY;
m_pImage->Translate(deltaX, deltaY);
double diffAngle = m_angle - m_pImage->GetAngle();
if(diffAngle < -180)
diffAngle += 360;
else if(diffAngle > 180)
diffAngle -= 360;
double deltaAngle = diffAngle*m_speed*elapsedTime;
if(fabs(deltaAngle) > fabs(diffAngle))
deltaAngle = diffAngle;
m_pImage->SetAngle(m_pImage->GetAngle() + deltaAngle);
if(!IsMoving(0.5f) && m_bEndIfStatic)
Success();
}
开发者ID:Polydash,项目名称:Gomez,代码行数:33,代码来源:SmoothFollowProcess.cpp
示例9: UpdateMovement
void CEntity::UpdateMovement(Ogre::Real ElapsedTime)
{
//Also update walk/idle animation?
if( IsMoving() ){
Ogre::Real LenghtLeftToGo = (GetDestination() - GetPosition()).length();
Ogre::Vector3 Movement = GetMovement();
Ogre::Vector3 CorrectedMovement = ( Movement * ElapsedTime );
//Set the right angle for the entity
mNode->lookAt( GetDestination(), Ogre::Node::TS_WORLD );
if( CorrectedMovement.length() < LenghtLeftToGo ){ //Not at destination yet, just move
mNode->translate( CorrectedMovement );
}else{ //Arrived at destination
mNode->setPosition( GetDestination() );
ReachedDestination();
//TODO: If there is a next destination then go there with the frametime left of this movement.
//(Loop till all frametime is used for movement)
//Example: if there are 3 destinations left, and the first 2 will be reached
//in 2 seconds.
//If the user has a slow computer that updates the frame every 2,5 seconds,
//then it should first use x seconds to reach destination one, then check
//for how many seconds left, and use those to go to the next node and so on.
}
}
}
开发者ID:alexleclair,项目名称:NNYv3,代码行数:26,代码来源:Entity.cpp
示例10: switch
void CAI_PlayerAlly::RunTask( const Task_t *pTask )
{
switch( pTask->iTask )
{
case TASK_TALKER_CLIENT_STARE:
case TASK_TALKER_LOOK_AT_CLIENT:
if ( pTask->iTask == TASK_TALKER_CLIENT_STARE )
{
// Get edict for one player
CBasePlayer *pPlayer = (CBasePlayer *)CBaseEntity::Instance( engine->PEntityOfEntIndex( 1 ) );
Assert( pPlayer );
// fail out if the player looks away or moves away.
if ( ( pPlayer->GetLocalOrigin() - GetLocalOrigin() ).Length2D() > TLK_STARE_DIST )
{
// player moved away.
TaskFail("Player moved away");
}
Vector forward;
AngleVectors( pPlayer->GetLocalAngles(), &forward );
if ( UTIL_DotPoints( pPlayer->GetLocalOrigin(), GetLocalOrigin(), forward ) < m_flFieldOfView )
{
// player looked away
TaskFail("Player looked away");
}
}
if ( gpGlobals->curtime > m_flWaitFinished )
{
TaskComplete();
}
break;
case TASK_TALKER_EYECONTACT:
if (IsMoving() || !GetExpresser()->IsSpeaking() || GetSpeechTarget() == NULL)
{
TaskComplete();
}
break;
case TASK_WAIT_FOR_MOVEMENT:
if (!GetExpresser()->IsSpeaking() || GetSpeechTarget() == NULL)
{
// override so that during walk, a scientist may talk and greet player
FIdleHello();
if (random->RandomInt(0,m_nSpeak * 20) == 0)
{
FIdleSpeak();
}
}
BaseClass::RunTask( pTask );
break;
default:
BaseClass::RunTask( pTask );
}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:60,代码来源:npc_talker.cpp
示例11: Move
void CObject::Move ( const CVector& vecPosition, const CVector& vecRotation, unsigned long ulTime )
{
// Are we already moving?
if ( IsMoving () )
{
// Stop our current movement
StopMoving ();
}
// If it's more than 0 milliseconds
if ( ulTime > 0 )
{
// Setup our move data
m_moveData.vecStartPosition = GetPosition ();
m_moveData.vecStopPosition = vecPosition;
GetRotation ( m_moveData.vecStartRotation );
m_moveData.vecStopRotation = vecRotation;
m_moveData.ulTime = ulTime;
m_moveData.ulTimeStart = GetTime ();
m_moveData.ulTimeStop = m_moveData.ulTimeStart + ulTime;
m_moveData.bActive = true;
}
// If we have a time of 0, move there now
else
{
SetPosition ( vecPosition );
CVector vecTemp;
GetRotation ( vecTemp );
SetRotation ( vecTemp + vecRotation );
}
}
开发者ID:50p,项目名称:multitheftauto,代码行数:31,代码来源:CObject.cpp
示例12: StopFollowing
void CSyncCoreObjectMediator::DisbindConnection()
{
if( !m_pConn )
return;
if(!IsActive())
StopFollowing();
if(IsMoving())
StopMoving();
m_bDisbindingConn = false;
GetScene()->DelFromMulticast( m_pConn );
m_fDirKnownMaxSpeed = 0;
//cout<<"DisbindConnection DestroyObjForConnection "<<GetGlobalID()<<endl;
DestroyObjForConnection( m_pConn );
m_pConn->SetMediator(NULL);
AddConnBlockCount();
//关联某个连接,必须最后将m_pConn设置为NULL
IntSetConnection(NULL);
(new CCoreObjOnConnectionDisbindedResult(GetGlobalID()))->Add();
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:26,代码来源:CSyncCoreObjectMediator.cpp
示例13: IsMovable
bool Game_Vehicle::IsMovable() {
if (!IsInUse())
return false;
if (type == Airship && (IsAscending() || IsDescending()))
return false;
return !IsMoving();
}
开发者ID:stavrossk,项目名称:Player,代码行数:7,代码来源:game_vehicle.cpp
示例14: if
const CVector& CObject::GetPosition ( void )
{
// Are we attached to something?
if ( m_pAttachedTo )
{
m_vecPosition = m_pAttachedTo->GetPosition ();
m_vecPosition += m_vecAttachedPosition;
}
// Are we moving?
else if ( IsMoving () )
{
// Calculate our current Position
unsigned long ulCurrentTime = GetTime ();
// Grab the difference between start and finish
CVector vecJourney = m_moveData.vecStopPosition - m_moveData.vecStartPosition;
// Grab the duration the object takes to move
float fDuration = static_cast < float > ( m_moveData.ulTime );
// Grab the time that has passed since we started moving
float fTimePassed = static_cast < float > ( ulCurrentTime - m_moveData.ulTimeStart );
// How far along our journey should we be?
vecJourney /= fDuration;
vecJourney *= fTimePassed;
// Update our stored position
m_vecPosition = m_moveData.vecStartPosition + vecJourney;
}
// Finally, return it
return m_vecPosition;
}
开发者ID:50p,项目名称:multitheftauto,代码行数:33,代码来源:CObject.cpp
示例15: GetAbsOrigin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CNPC_Monster::PrescheduleThink( void )
{
bool bNearEnemy = false;
if ( GetEnemy() != NULL )
{
float flDist = (GetEnemy()->GetAbsOrigin() - GetAbsOrigin()).Length();
if ( flDist < ZOMBIE_ENEMY_BREATHE_DIST )
{
bNearEnemy = true;
}
}
if ( bNearEnemy )
{
if ( !m_bNearEnemy )
{
m_bNearEnemy = true;
}
}
else if ( m_bNearEnemy )
{
m_bNearEnemy = false;
}
BaseClass::PrescheduleThink();
// We're chopped off! And we're moving! Add some blood trail...
if (m_fIsTorso && IsMoving() && (m_flLastBloodTrail < gpGlobals->curtime))
{
m_flLastBloodTrail = gpGlobals->curtime + 1.0f; // We don't want to spam blood all over the place.
trace_t tr;
UTIL_TraceLine((GetAbsOrigin() + Vector(0, 0, 50)), (GetAbsOrigin() + Vector(0, 0, -300)), MASK_ALL, this, COLLISION_GROUP_NONE, &tr);
UTIL_DecalTrace(&tr, "Blood");
}
}
开发者ID:BerntA,项目名称:tfo-code,代码行数:38,代码来源:npc_monster.cpp
示例16: UpdatePosition
void PhysicalObj::UpdatePosition()
{
// No ghost allowed here !
if (IsGhost()) {
return;
}
if (m_collides_with_ground) {
// object is not moving
if (!IsMoving()) {
// and has no reason to move
if (!FootsInVacuum()) {
if (!IsInWater()) {
return;
}
} else {
// it should fall !
StartMoving();
}
}
}
// Compute new position.
RunPhysicalEngine();
if (IsGhost()) {
return;
}
// Classical object sometimes sinks in water and sometimes goes out of water!
if (m_collides_with_ground) {
if (IsInWater() && m_alive!=DROWNED && m_alive!=DEAD) Drown();
else if (!IsInWater() && m_alive==DROWNED) GoOutOfWater();
}
}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:35,代码来源:physical_obj.cpp
示例17: IsMoving
void Game_Player::Update() {
bool last_moving = IsMoving() || IsJumping();
if (IsMovable() && !Game_Map::GetInterpreter().IsRunning()) {
switch (Input::dir4) {
case 2:
Move(Down);
break;
case 4:
Move(Left);
break;
case 6:
Move(Right);
break;
case 8:
Move(Up);
}
}
UpdateScroll();
Game_Character::Update();
if (location.aboard)
GetVehicle()->SyncWithPlayer();
UpdateNonMoving(last_moving);
}
开发者ID:Uladox,项目名称:Player,代码行数:27,代码来源:game_player.cpp
示例18: Refresh
void DiscoGrenade::Refresh()
{
WeaponProjectile::Refresh();
#ifdef HAVE_A_REALLY_BIG_CPU
if(IsMoving()) {
Double norme,angle;
GetSpeed(norme,angle);
for (int i = -3; i<4 ; i++)
smoke_engine.AddNow(GetPosition(), 1, particle_MAGIC_STAR, false,
angle+(i*QUARTER_PI/3.0)+HALF_PI, 2.0);
} else {
smoke_engine.AddNow(GetPosition(), 1, particle_MAGIC_STAR, false,
((Double)(GameTime::GetInstance()->Read()%500)-250.0) * PI / 250.0, 3.0);
}
#else // :-P
smoke_engine.AddPeriodic(GetPosition(), particle_MAGIC_STAR, false);
#endif //HAVE_A_REALLY_BIG_CPU
int tmp_time = GetMSSinceTimeoutStart();
// Ah ! Ah ! Ah ! Staying Alive, staying alive ...
if (GetTotalTimeout() >= 2 && tmp_time > (1000 * GetTotalTimeout() - 2000) && !have_played_music) {
//JukeBox::GetInstance()->Play("default","weapon/alleluia") ;
have_played_music = true;
}
image->SetRotation_rad(GetSpeedAngle());
}
开发者ID:fluxer,项目名称:warmux,代码行数:27,代码来源:disco_grenade.cpp
示例19: Afraid
void CHostageImprov::Afraid()
{
char animInto[32];
char animLoop[32];
char animExit[32];
if (IsCrouching())
return;
if (m_animateState.GetPerformance() == HostageAnimateState::Flinching ||
m_animateState.GetPerformance() == HostageAnimateState::Afraid)
return;
if (!IsMoving())
{
m_animateState.Reset();
m_animateState.SetPerformance(HostageAnimateState::Afraid);
int which = RANDOM_LONG(0, 100) % 3 + 1;
Q_sprintf(animInto, "cower_into_%d", which);
Q_sprintf(animLoop, "cower_loop_%d", which);
Q_sprintf(animExit, "cower_exit_%d", which);
m_animateState.AddSequence(this, animInto);
m_animateState.AddSequence(this, animLoop, RANDOM_FLOAT(3, 10));
m_animateState.AddSequence(this, animExit);
}
}
开发者ID:Solexid,项目名称:ReGameDLL_CS,代码行数:29,代码来源:hostage_improv.cpp
示例20: UpdatePhysicalStateBit
void CFeature::SetVelocity(const float3& v)
{
CWorldObject::SetVelocity(v);
UpdatePhysicalStateBit(CSolidObject::PSTATE_BIT_MOVING, v != ZeroVector);
if (IsMoving()) {
featureHandler->SetFeatureUpdateable(this, true);
}
}
开发者ID:AMDmi3,项目名称:spring,代码行数:9,代码来源:Feature.cpp
注:本文中的IsMoving函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论