示例#1
0
void MultiShot::Update( void ) {
	Attackable *temp;

	/* If we have Targets, check their status. */
	if( pTarget != NULL  || pTarget2 != NULL || pTarget3 != NULL )
		CheckTarget();

	/* Search for Targets. */
	if( pTarget == NULL || pTarget2 == NULL || pTarget3 == NULL )
		FindTarget();

	/* If we found a new Target, and they are in range.. */
	if( pTarget != NULL )
		Attack();

	/*Using a temp target to hold the pTarget. This way we don't have to override Attack().*/
	if( pTarget2 != NULL ) {
		temp = pTarget;
		pTarget = pTarget2;
		Attack();
		pTarget = temp;
	}

	if( pTarget3 != NULL ) {
		temp = pTarget;
		pTarget = pTarget3;
		Attack();
		pTarget = temp;
	}
}
/*
================
rvWeaponMachinegun::State_Fire
================
*/
stateResult_t rvWeaponMachinegun::State_Fire ( const stateParms_t& parms ) {
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	

	switch ( parms.stage ) {
		case STAGE_INIT:
			if ( wsfl.zoom ) {
				nextAttackTime = gameLocal.time + (altFireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
				Attack ( true, 1, spreadZoom, 0, 1.0f );
				fireHeld = true;
			} else {
				nextAttackTime = gameLocal.time + (fireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
				Attack ( false, 1, spread, 0, 1.0f );
			}
			PlayAnim ( ANIMCHANNEL_ALL, "fire", 0 );	
			return SRESULT_STAGE ( STAGE_WAIT );
	
		case STAGE_WAIT:		
			if ( !fireHeld && wsfl.attack && gameLocal.time >= nextAttackTime && AmmoInClip() && !wsfl.lowerWeapon ) {
				SetState ( "Fire", 0 );
				return SRESULT_DONE;
			}
			if ( AnimDone ( ANIMCHANNEL_ALL, 0 ) ) {
				SetState ( "Idle", 0 );
				return SRESULT_DONE;
			}		
			if ( UpdateFlashlight ( ) ) {
				return SRESULT_DONE;
			}			
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
示例#3
0
void Bot::OnAttack(int damage, Bot* attacker)
{
	unit->Hit(damage, normal);

	if (unit->GetHP() <= 0)
	{
		OnKill();
	}
	else if (unit->team == App->AI->playerTeam)
	{
		if (unit->ArrivedToDestination())
		{
			Attack(attacker);
		}
	}
	else if (father)
	{
		App->AI->OnUnitDanger(father, this);
	}
	else if (flees)
	{
		if (unit->GetHP() < unit->GetMaxHP() / 10)
			SetState(flee);
		else
			SetState(attack);
	}
	else if (state != attack)
		Attack(attacker);
}
示例#4
0
void Party::initPartyMemberC() {
    std::vector<float> affinities = {1.5, 1.5, 1.5, 1, 1, 1, 1};
    std::vector<Attack> attacks;
    attacks.push_back(Attack("Arrow", 1, pierce));
    attacks.push_back(Attack("Lightning", 9, lightning));
    
    C = PartyMember("Mage", 50, 40, 2, attacks, affinities);
}
示例#5
0
void Party::initPartyMemberB() {
    std::vector<float> affinities = {0.5, 0.5, 0.5, 1, 1, 1, 1};
    std::vector<Attack> attacks;
    attacks.push_back(Attack("Crush", 8, crush));
    attacks.push_back(Attack("Water", 2, water));
    
    B = PartyMember("Tank", 50, 40, 2, attacks, affinities);
}
示例#6
0
void Party::initPartyMemberA() {
    std::vector<float> affinities = {1, 1, 1, 1, 1, 1, 1};
    std::vector<Attack> attacks;
    attacks.push_back(Attack("Punch", 2, pierce));
    attacks.push_back(Attack("Fire", 4, fire));
    attacks.push_back(Attack("Sword", 6, slash));
    
    A = PartyMember("DPS", 50, 40, 3, attacks, affinities);
}
示例#7
0
/*
================
rvMonsterStroggHover::DoNamedAttack
================
*/
void rvMonsterStroggHover::DoNamedAttack ( const char* attackName, jointHandle_t joint ) {
	if ( joint != INVALID_JOINT ) {
		StartSound ( va("snd_%s_fire",attackName), SND_CHANNEL_ANY, 0, false, NULL );
		PlayEffect ( va("fx_%s_flash",attackName), joint );
		Attack ( attackName, joint, GetEnemy() );
	}
}
bool SoulDestroyer::Advance( Unit *_unit )
{
    if( m_dead ) return AdvanceDead( _unit );
        
    if( m_panic > 0.0 )
    {
        m_targetEntity.SetInvalid();
        if( syncfrand(10.0) < 5.0 )
        {
            SearchForRetreatPosition();
        }
        m_panic -= SERVER_ADVANCE_PERIOD;
    }    
    else if( m_targetEntity.IsValid() )
    {
        WorldObject *target = g_app->m_location->GetEntity( m_targetEntity );
        if( target )
        {
            double distance = (target->m_pos - m_pos).Mag();
            m_targetPos = target->m_pos;            

            if( distance > SOULDESTROYER_MAXSEARCHRANGE )
            {
                m_targetEntity.SetInvalid();
            }
        }
        else
        {
            m_targetEntity.SetInvalid();
        }
    }

    m_retargetTimer -= SERVER_ADVANCE_PERIOD;

    bool arrived = AdvanceToTargetPosition();
    if( arrived || m_targetPos == g_zeroVector || m_retargetTimer < 0.0)
    {
        m_retargetTimer = 5.0;
        bool found = false;
        if( !found && m_panic < 0.1 ) found = SearchForTargetEnemy();
        if( !found ) found = SearchForRandomPosition();
    }

    RecordHistoryPosition();

    if( m_panic < 0.1 ) Attack( m_pos );

#ifdef USE_DIRECT3D
	if(g_deformEffect)
	{
		Vector3* pos1 = m_positionHistory.GetPointer(m_positionHistory.Size()-1);
		Vector3* pos2 = m_positionHistory.GetPointer(m_positionHistory.Size()-2);
		//if(pos1) g_deformEffect->AddTearing(*pos1,0.4);
		//if(pos1 && pos2) g_deformEffect->AddTearing((*pos1+*pos2)*0.5,0.4);
		if(pos1 && pos2) g_deformEffect->AddTearingPath(*pos1,*pos2,0.4);
	}
#endif

	return Entity::Advance(_unit);
}
// Called every frame
void AZombieCharacter::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	GetCharacterMovement()->MaxWalkSpeed = InitialMaxWalkSpeed;
	ZAnimInstance->Speed = InitialMaxWalkSpeed;

	//If the zombie is within the melee range cancel any movement animation so it's more realistic
	float Distance = FVector::Dist(GetActorLocation(),OurCharacter->GetActorLocation());
	if (Distance<= MeleeDistanceThreshold)
	{
		ZAnimInstance->Speed = 0;
	}

	//Enable the attack raycast sphere in zombies hand if the animation is valid
	if (ZAnimInstance->bEligibleForAttack)
	{
		Attack();
		if (GetCharacterMovement())
		{
			GetCharacterMovement()->MaxWalkSpeed = InitialMaxWalkSpeed;
		}
	}

	//Updates the alpha value if the zombie is dead to achieve over-time fade out
	if(!IsAlive())
	{
		//Ticks the alpha reduction timeline
		AlphaReductionTimeline.TickTimeline(DeltaTime);
	}

}
示例#10
0
void CObjectSentrygun::SentryThink( void )
{
	switch( m_iState )
	{
	case SENTRY_STATE_INACTIVE:
		break;

	case SENTRY_STATE_SEARCHING:
		SentryRotate();
		break;

	case SENTRY_STATE_ATTACKING:
		Attack();
		break;

	case SENTRY_STATE_UPGRADING:
		UpgradeThink();
		break;

	default:
		Assert( 0 );
		break;
	}

	SetContextThink( &CObjectSentrygun::SentryThink, gpGlobals->curtime + SENTRY_THINK_DELAY, SENTRYGUN_CONTEXT );
}
示例#11
0
void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
    super::Tick(a_Dt, a_Chunk);

    if (m_EMState == CHASING)
    {
        CheckEventLostPlayer();
    }
    else
    {
        CheckEventSeePlayer();
    }

    if (m_Target == nullptr)
    {
        return;
    }

    cTracer LineOfSight(GetWorld());
    Vector3d MyHeadPosition = GetPosition() + Vector3d(0, GetHeight(), 0);
    Vector3d AttackDirection(m_Target->GetPosition() + Vector3d(0, m_Target->GetHeight(), 0) - MyHeadPosition);


    if (TargetIsInRange() && !LineOfSight.Trace(MyHeadPosition, AttackDirection, static_cast<int>(AttackDirection.Length())) && (GetHealth() > 0.0))
    {
        // Attack if reached destination, target isn't null, and have a clear line of sight to target (so won't attack through walls)
        StopMovingToPosition();
        Attack(a_Dt);
    }
}
示例#12
0
void AIEnemyZombie::UseBrain()
{
	xtile = aiinput->GetXTilePos();
	ytile = aiinput->GetYTilePos();
	xpos = aiinput->GetXLoc();
	ypos = aiinput->GetYLoc();

	if(new_enemy){
		new_enemy=false;
		//if( (aiinput->lower_patrol_x > 0) && (aiinput->upper_patrol_x > 0)) use_patrol_bounds = true;
	}

	


	switch(GetState())
	{
	case AIS_CHASE:
		Chase();
		break;
	case AIS_ATTACK:
		Attack();
		break;
	case AIS_PATROL:
		Patrol();
		break;
	case AIS_MOVE:
		MoveToXTile(movetoxtile);
		break;
	case AIS_WAIT:
		Wait();
		break;

	}
}
示例#13
0
//이번턴의 결과값이 Destroy라면?
Position Player::DestroyFind( int size )
{
	//일단 공격한 위치를 Destroy리스트에 집어넣는다.
    m_DestroyPosList.push_back( m_LastHit );
    Position curPos = m_LastHit;
    MyDirection destroyDir = m_FindDir;
	//그리고 현재 방향에서부터 destroy된 배가 놓인 방향을 찾는다.
    FindDestroyDir( curPos , size , &destroyDir );
	//찾은 다음에 HitPosList에서 destroy된 배가 가진 위치들을 제외시킨다.
	//파괴된 배는 이제 더 이상 타겟이 아니기 때문
    RemoveDestroyedPath( curPos , size , destroyDir );

	//이렇게해서 남은 Hitpos가 없다면 HUNT모드로 전환하여 공격
    if( m_HitPosList.empty() )
    {
        m_AImode = HUNT;
        return Attack();
    }
	//아직 남아있다면 Origin을 변경시켜서 MissFind방법으로 다시 추적시작
    else
    {
        m_Origin = m_HitPosList.front();
        return MissFind();
    }
}
示例#14
0
bool CActions::CopyAttack(int unit,set<int> tocopy){
	float3 p = G->GetUnitPos(unit);
	if(G->Map->CheckFloat3(p)==false){
		return false;
	}
	int* a = new int[10000];
	int n = G->cb->GetFriendlyUnits(a,p,900.0f);
	if(n > 1){
		//
		for(int i =0; i < n; i++){
			if(i == unit) continue;
			if(tocopy.find(i) == tocopy.end()) continue;
			const deque<Command>* vc = G->cb->GetCurrentUnitCommands(i);
			if(vc == 0) continue;
			if(vc->empty()) continue;
			for(deque<Command>::const_iterator q = vc->begin(); q != vc->end(); ++q){
				//
				if(q->id == CMD_ATTACK){
					delete [] a;
					int eu = (int)q->params.front();
					return Attack(unit,eu,false);
				}
			}
		}
	}
	delete [] a;
	return false;
}
示例#15
0
bool SynthNote::AttackNote(
			SynthPartElement *				inPart,
			SynthGroupElement *				inGroup,
			NoteInstanceID					inNoteID, 
			UInt64							inAbsoluteSampleFrame, 
			UInt32							inOffsetSampleFrame, 
			const MusicDeviceNoteParams		&inParams)
{
#if DEBUG_PRINT
	printf("SynthNote::AttackNote %lu %lu abs frame %llu rel frame %lu\n", (UInt32)inGroup->GroupID(), (UInt32)inNoteID, inAbsoluteSampleFrame, inOffsetSampleFrame);
#endif
	mPart = inPart;
	mGroup = inGroup;
	mNoteID = inNoteID;

	mAbsoluteStartFrame = inAbsoluteSampleFrame;
	mRelativeStartFrame = inOffsetSampleFrame;
	mRelativeReleaseFrame = -1;
	mRelativeKillFrame = -1;

	mPitch = inParams.mPitch;
	mVelocity = inParams.mVelocity;
	
	
	return Attack(inParams);
}
示例#16
0
// What to do if in Chasing State
void cAggressiveMonster::InStateChasing(float a_Dt)
{
	super::InStateChasing(a_Dt);
	m_ChaseTime += a_Dt;
	if (m_Target != NULL)
	{
		if (m_Target->IsPlayer())
		{
			cPlayer * Player = (cPlayer *) m_Target;
			if (Player->IsGameModeCreative())
			{
				m_EMState = IDLE;
				return;
			}
		}

		Vector3f Pos = Vector3f( GetPosition() );
		Vector3f Their = Vector3f( m_Target->GetPosition() );
		if ((Their - Pos).Length() <= m_AttackRange)
		{
			Attack(a_Dt);
		}
		MoveToPosition(Their + Vector3f(0, 0.65f, 0));
	}
	else if (m_ChaseTime > 5.f)
	{
		m_ChaseTime = 0;
		m_EMState = IDLE;
	}	
} 
示例#17
0
void cAggressiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
{
	super::Tick(a_Dt, a_Chunk);

	if (m_EMState == CHASING)
	{
		CheckEventLostPlayer();
	}
	else
	{
		CheckEventSeePlayer();
	}

	if (m_Target == NULL)
		return;

	cTracer LineOfSight(GetWorld());
	Vector3d AttackDirection(m_Target->GetPosition() - GetPosition());

	if (ReachedFinalDestination() && !LineOfSight.Trace(GetPosition(), AttackDirection, (int)AttackDirection.Length()))
	{
		// Attack if reached destination, target isn't null, and have a clear line of sight to target (so won't attack through walls)
		Attack(a_Dt / 1000);
	}
}
示例#18
0
文件: xen.cpp 项目: Arkshine/NS
void CXenTree :: Touch( CBaseEntity *pOther )
{
	if ( !pOther->IsPlayer() && FClassnameIs( pOther->pev, "monster_bigmomma" ) )
		return;

	Attack();
}
示例#19
0
int main(int argc, char* argv[])
{
	char *server;
	NETRESOURCE nr;
	char unc[MAX_PATH];
	char szPipe[MAX_PATH];
	HANDLE hFile;

	if (argc < 2)
	{
		printf("Usage: %s <host>\n", argv[0]);
		return 1;
	}
	server=argv[1];
	_snprintf(unc, sizeof(unc), "\\\\%s\\pipe", server);
	unc[sizeof(unc)-1] = 0;
	nr.dwType       = RESOURCETYPE_ANY;
	nr.lpLocalName  = NULL;
	nr.lpRemoteName = unc;
	nr.lpProvider   = NULL;
	WNetAddConnection2(&nr, "", "", 0);

	_snprintf(szPipe, sizeof(szPipe), "\\\\%s\\pipe\\browser",server);
	hFile = CreateFile(szPipe, GENERIC_READ|GENERIC_WRITE, 0, NULL, 
OPEN_EXISTING, 0, NULL);
	
BindRpcInterface(hFile,"8d9f4e40-a03d-11ce-8f69-
08003e30051b","1.0");

	//SendMalformed RPC request
	Attack(hFile);
	return 0;
}
示例#20
0
/*
================
rvWeaponShotgun::State_Fire
================
*/
stateResult_t rvWeaponShotgun::State_Fire( const stateParms_t& parms ) {
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	
	switch ( parms.stage ) {
		case STAGE_INIT:
			nextAttackTime = gameLocal.time + (fireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
			Attack( false, hitscans, spread, 0, 1.0f );
			PlayAnim( ANIMCHANNEL_ALL, "fire", 0 );	
			return SRESULT_STAGE( STAGE_WAIT );
	
		case STAGE_WAIT:
			if ( (!gameLocal.isMultiplayer && (wsfl.lowerWeapon || AnimDone( ANIMCHANNEL_ALL, 0 )) ) || AnimDone( ANIMCHANNEL_ALL, 0 ) ) {
				SetState( "Idle", 0 );
				return SRESULT_DONE;
			}									
			if ( wsfl.attack && gameLocal.time >= nextAttackTime && AmmoInClip() ) {
				SetState( "Fire", 0 );
				return SRESULT_DONE;
			}
			if ( clipSize ) {
				if ( (wsfl.netReload || (wsfl.reload && AmmoInClip() < ClipSize() && AmmoAvailable()>AmmoInClip())) ) {
					SetState( "Reload", 4 );
					return SRESULT_DONE;			
				}				
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
示例#21
0
//타겟모드인데 이번턴에 놓쳤으면?
Position Player::MissFind()
{
    Position nextPos; //다음 공격 위치
    bool findNextPos = false; //적당한 다음 공격 위치를 찾았다면 true
    
	//일단 현재 Origin으로 돌아가서 다른 방향을 시도해본다.(TryOtherDirection)
	//시도가 성공하면 변경된 nextPos값으로 공격
	//실패하면 (origin이 사방으로 막혀있는 경우) 
	//origin을 hitPosList에 저장된 다른 HitPos로 변경하고 다시 방향을 탐색한다.
	for( auto hitPos : m_HitPosList )
    {
        if( findNextPos = TryOtherDirection( &nextPos ) )
        {
            break;
        }
        m_Origin = hitPos;
    }
    
	//모든 HitPos들을 돌았는데도 다음 공격할 위치가 없다.(매우 적은 확률로 존재)
	//그러면 그냥 타겟모드를 포기하고 기존 HUNT의 공격방식으로 돌아간다.
    if( !findNextPos )
    {
        m_AImode = HUNT;
        nextPos = Attack();
    }


	//이렇게 했는데도 잘못된 결과가 나오면 ASSERT에 걸립니다. 하하
    HitResult result = m_EnemyBoard->GetBoardStatus( nextPos );
    _ASSERT( result == WATER );
    
    return nextPos;
}
示例#22
0
	void Update()
	{
		Attack();
		if     (dir == 1) Pos.y--;
		else if(dir == 2) Pos.x++;
		else if(dir == 3) Pos.y++;
		else if(dir == 4) Pos.x--;
	}
示例#23
0
文件: SpyCard.cpp 项目: npburg/domlib
void SpyCard::OnActionPhase( Engine* pEngine )
{
    Player* pPlayer = pEngine->GetCurrentPlayer();

    pPlayer->DrawCardsToHand( 1 );
    pPlayer->PlusActions( 1 );
    Attack( pEngine, AttackWhom::ALL );
}
示例#24
0
	void Update()
	{
		Attack();
		if(distance >  3) dir = false;
		if(distance < -2) dir = true;
		distance += dir ? 1 : -1;
		Pos.x += dir ? 1 : -1;
	}
示例#25
0
void CPlayerOne::ActionThead(){
	/*Commands you can use to play.
	  void MoveForward(int delay);
	  void MoveBackward(int delay);
	  void Jump(int delay);
	  void Attack();
	  void crouch(int delay);
	  void upSword(int delay);*/
	
	while (1){
		//################Example of a bot (You can erase and rewrite this code)(You need to program you bot inside of this While() block)
		MoveForward(0);
		Attack();
		MoveBackward(0);
		Attack();
		//################Example of a bot (You can erase and rewrite this code)(You need to program you bot inside of this While() block)
	}
}
void AIEnemyAdvancedGeneticMonster2::UseBrain()
{
	xtile = aiinput->GetXTilePos();
	ytile = aiinput->GetYTilePos()-1;
	xpos = aiinput->GetXLoc();
	ypos = aiinput->GetYLoc();

	int pyt = aio->player_input->GetYTilePos();
	int th = abs(ytile - pyt);

	if(aiinput->GetStateFlags()->S_DEAD) return;
	
	if(new_enemy)
	{
		new_enemy = false;
		cur_health = aiinput->GetCurLife();
	}

	prev_health = cur_health;
	cur_health = aiinput->GetCurLife();

	
	
	if( (prev_health - cur_health) >0 ) damaged = true;
	else damaged = false;

/*#ifdef _DEBUG
	char temp[256];
	sprintf(temp, "{AI}[AGM] (th:%d)", th);
	OutputDebugString(temp);
#endif*/

	switch(GetState())
	{
	case AIS_CHASE:
		Chase();
		break;
	case AIS_ATTACK:
		Attack();
		break;
	case AIS_PATROL:
		Patrol();
		break;
	case AIS_MOVE:
		MoveToXTile(movetoxtile);
		break;
	case AIS_WAIT:
		Wait();
		break;
/*	case AIS_NAVIGATE_DOWN:
		break;
	case AIS_NAVIGATE_UP:
		break;*/
	}
}
/*
================
rvWeaponGauntlet::State_Fire
================
*/
stateResult_t rvWeaponGauntlet::State_Fire( const stateParms_t& parms ) {
	enum {
		STAGE_START,
		STAGE_START_WAIT,
		STAGE_LOOP,
		STAGE_LOOP_WAIT,
		STAGE_END,
		STAGE_END_WAIT
	};	
	switch ( parms.stage ) {
		case STAGE_START:	
			PlayAnim( ANIMCHANNEL_ALL, "attack_start", parms.blendFrames );
			StartBlade();
			loopSound = LOOP_NONE;
			// #32 - no gauntlet spin up
			//return SRESULT_STAGE( STAGE_START_WAIT );
			return SRESULT_STAGE( STAGE_LOOP );
		
		case STAGE_START_WAIT:
			if ( !wsfl.attack ) {
				return SRESULT_STAGE( STAGE_END );
			}
			if ( AnimDone( ANIMCHANNEL_ALL, parms.blendFrames ) ) {
				return SRESULT_STAGE( STAGE_LOOP );
			}
			return SRESULT_WAIT;
			
		case STAGE_LOOP:
			PlayCycle( ANIMCHANNEL_ALL, "attack_loop", parms.blendFrames );
			StartSound( "snd_spin_loop", SND_CHANNEL_WEAPON, 0, false, 0 );
			return SRESULT_STAGE(STAGE_LOOP_WAIT);
			
		case STAGE_LOOP_WAIT:
			if ( !wsfl.attack || wsfl.lowerWeapon ) {
				return SRESULT_STAGE( STAGE_END );
			}
			Attack();
			return SRESULT_WAIT;
		
		case STAGE_END:
			PlayAnim( ANIMCHANNEL_ALL, "attack_end", parms.blendFrames );
			StopBlade();
			StartSound( "snd_spin_down", SND_CHANNEL_WEAPON, 0, false, 0 );
			return SRESULT_STAGE( STAGE_END_WAIT );
		
		case STAGE_END_WAIT:
			if ( wsfl.attack || AnimDone( ANIMCHANNEL_ALL, parms.blendFrames ) ) {
				PostState( "Idle", parms.blendFrames );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}			
	return SRESULT_ERROR;
}
示例#28
0
/*
================
WeaponNapalmGun::State_Fire
================
*/
stateResult_t WeaponNapalmGun::State_Fire( const stateParms_t& parms ) {
	enum {
		STAGE_INIT,
		STAGE_WAIT,
	};	
	switch ( parms.stage ) {
		case STAGE_INIT:
			if ( wsfl.zoom ) {
				nextAttackTime = gameLocal.time + (altFireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
				Attack ( true, 1, spread, 0, 1.0f );
				PlayAnim ( ANIMCHANNEL_ALL, "idle", parms.blendFrames );
				//fireHeld = true;
			} else {
				nextAttackTime = gameLocal.time + (fireRate * owner->PowerUpModifier ( PMOD_FIRERATE ));
				Attack ( false, 1, spread, 0, 1.0f );

				int animNum = viewModel->GetAnimator()->GetAnim ( "fire" );
				if ( animNum ) {
					idAnim* anim;
					anim = (idAnim*)viewModel->GetAnimator()->GetAnim ( animNum );				
					anim->SetPlaybackRate ( (float)anim->Length() / (fireRate * owner->PowerUpModifier ( PMOD_FIRERATE )) );
				}

				PlayAnim ( ANIMCHANNEL_ALL, "fire", parms.blendFrames );
			}

			previousAmmo = AmmoInClip();
			return SRESULT_STAGE ( STAGE_WAIT );
	
		case STAGE_WAIT:			
			if ( AnimDone ( ANIMCHANNEL_ALL, 0 ) ) {
				if ( !wsfl.zoom ) 
					SetState ( "Reload", 4 );
				else
					SetState ( "Idle", 4 );
				return SRESULT_DONE;
			}
			return SRESULT_WAIT;
	}
	return SRESULT_ERROR;
}
示例#29
0
void GamePan::nextPuzzle()
{
	if(checkAnswer())
	{
		Attack(_isPlayer?PLAYER_ATTACK:NPC_ATTACK);
	}
	else
	{
		Utils::openTip(TIP_SELECT_WRONG);
	}
	showHideConfirmPad(false);
}
示例#30
0
文件: Animal.cpp 项目: hLachev/God
void Animal::DoAction(std::unique_ptr<Planet>& p,Entity& otherentity)
{
	int number = RandomGenerator::GetRGen()->RandomNumber(5);
	switch(number)
	{
		case 1: Attack(otherentity); break;
		case 2: Sleep(); break;
		case 3: SearchForFood(); break;
		case 4: Eat(); break;
		case 5: Mate(p); break;
	};		 
}