示例#1
0
void rvMonsterStroggHover::TryStartPursuit ( void )
{
	if ( GetEnemy() )
	{
		inPursuit = false;
		if ( !marker.GetEntity() ) {
			//wtf?!
			assert(0);
			return;
		}
		attackPosOffset.Set( gameLocal.random.CRandomFloat()*500.0f, gameLocal.random.CRandomFloat()*500.0f, 0.0f );
		if ( attackPosOffset.Length() < 150.0f )
		{
			attackPosOffset.Normalize();
			attackPosOffset *= 150.0f;
		}
		attackPosOffset.z = (gameLocal.random.CRandomFloat()*30.0f)+50.0f + move.fly_offset;
		marker.GetEntity()->GetPhysics()->SetOrigin( GetEnemy()->GetPhysics()->GetOrigin()+attackPosOffset );
		if ( MarkerPosValid() )
		{
			if ( MoveToEntity( marker ) )
			{
				inPursuit = true;
				holdPosTime = 0;
				SetState( "State_Pursue" );
			}
		}
	}
}
示例#2
0
void CAIThread::GetMoveTarget()
{
	// TODO: Make this more better
	if ( m_pAttackTarget == NULL )
	{
		RandomMove();
	}
	else
	{
		MoveToEntity( m_pAttackTarget );
	}
	// m_pMoveTarget should never be NULL when exiting this function
	ASSERT( m_pMoveTarget != NULL );
}
示例#3
0
void rvMonsterStroggHover::Pursue ( void )
{
	if ( marker.GetEntity() && GetEnemy() )
	{
		marker.GetEntity()->GetPhysics()->SetOrigin( GetEnemy()->GetPhysics()->GetOrigin()+attackPosOffset );
		if ( DebugFilter(ai_debugMove) ) {
			gameRenderWorld->DebugAxis( marker.GetEntity()->GetPhysics()->GetOrigin(), marker.GetEntity()->GetPhysics()->GetAxis() );
		}
		if ( MarkerPosValid() )
		{
			bool breakOff = false;
			if ( move.fl.done )
			{//even once get there, hold that position for a while...
				if ( holdPosTime && holdPosTime > gameLocal.GetTime() )
				{//held this position long enough
					breakOff = true;
				}
				else
				{
					if ( !holdPosTime )
					{//just got there, hold position for a bit
						holdPosTime = gameLocal.random.RandomInt(2000)+3000 + gameLocal.GetTime();
					}
					if ( !MoveToEntity( marker ) )
					{
						breakOff = true;
					}
				}
			}
			if ( !breakOff )
			{
				return;
			}
		}
	}
	if ( !move.fl.done )
	{
		StopMove( MOVE_STATUS_DONE );
	}
	inPursuit = false;
}