void SimpleSkeletalAnimatedObject_cl::SetMode(SampleMode_e newMode)
{
  ClearData();
  m_eSampleMode = newMode;

  switch (newMode)
  {
  case MODE_SINGLEANIM:
    StartSingleAnimation(false); break;
  case MODE_BLENDTWOANIMS:
    BlendTwoAnimations(); break;
  case MODE_LISTENTOEVENTS:
    ListenToEvents(); break;
  case MODE_SETANIMATIONTIME:
    SetAnimationTime(); break;
  case MODE_LAYERTWOANIMATIONS:
    LayerTwoAnimations(); break;
  case MODE_FORWARDKINEMATICS:
    ForwardKinematics(); break;
  case MODE_LOOKAT:
    LookAt(); break;
  }

  // disable motion delta for this sample
  if (GetAnimConfig() != NULL)
    GetAnimConfig()->SetFlags(GetAnimConfig()->GetFlags() & ~APPLY_MOTION_DELTA);
}
Ejemplo n.º 2
0
 void SetAnimation(int y=0,int maxFrames=0,float timer=-1){
     if (timer >= 0){
         SetAnimationTime(timer);
     }
     isFormated = false;
     sprY = y;
     MaxFrames = maxFrames;
     ResetAnimation();
 }
Ejemplo n.º 3
0
void CSmashBot::Update(float fDelta)
{
	if(m_fIsFading > 0.0f)
	{
		m_fIsFading -= fDelta;
		D3DXMATRIX tempCurr = GetMatrix();
		tempCurr[13] -= m_fIsFading * 0.05f;
		SetMatrix(tempCurr);

		if(m_fIsFading <= 0.0f)
			CGame::GetInstance()->GetOF()->Destroy(this);
		return;
	}
	if(m_fDying)
	{
		m_fDying += fDelta;

		if( m_fDying > m_fDieTime )
		{
			m_fIsFading = 2.0f;
			return;
		}
		float animTime = GetAnimationTime();
		animTime += fDelta;
		if(animTime > m_fDieTime)
			animTime = m_fDieTime;
		CAnimationProcessor::UpdateTime(GetCurrentAnimation(), animTime);
		CAnimationProcessor::Interpolator(GetCurrentAnimation(), animTime, PassCurrFrame());
		SetAnimationTime(animTime);
		return;
	}

	if( m_bIsSmashing )
		SetColor(COLOR_SMASHBOT_VUL);
	else
	{
		SetColor(COLOR_SMASHBOT);
		m_fScrollTime -= fDelta;
	}

	float animTime = GetAnimationTime();
	animTime += fDelta;
	if(GetWalking() != SMASH_WALK)
		animTime = min(animTime, m_fMaxAnim);
	CAnimationProcessor::UpdateTime(GetCurrentAnimation(), animTime);
	CAnimationProcessor::Interpolator(GetCurrentAnimation(), animTime, PassCurrFrame());
	SetAnimationTime(animTime);

	if(GetWasHit() == true)
	{
		float temp = GetHitDuration();
		temp += fDelta;
		SetHitDuration(temp);
		SetBeingHit(1);
		SetColor(COLOR_SMASHBOT_HIT);

		if(HIT_CAP < temp)
		{
			SetWasHit(false);
			SetHitDuration(0.0f);
			SetBeingHit(0);
		}
	}

	if( GetHealth() <= 0 )
	{
		CPickup* pPickup = nullptr;
		if(CGame::GetInstance()->GetOF()->Create(OBJ_PICKUP,(IBaseObject**)&pPickup))
		{
			pPickup->SetMatrix(GetMatrix());
		}

		m_bIsSmashing = false;
		D3DXMATRIX d3dMat=GetMatrix();
		WwiseNS::PlaySFX(WwiseNS::EVENT_SOUND_EXPLOSION);
		CGameplayState::GetInstance()->GetFX()->CreateEffect(EFFECT_MEDEXP,d3dMat);
		TAnimation* tempAnim = CAssetManager::GetInstance()->GetAnimation(GetID(), SMASH_DEATH);
		m_fDieTime = tempAnim->m_fDuration;
		m_fDying = .00001f;
		SetBeingHit(0);
		ChangeAnimation(SMASH_DEATH);
		SetAlive(false);
		return;
	}

	m_cAI.Update(fDelta);
}
Ejemplo n.º 4
0
void CBurnBot::Update(float fDelta)
{
	if(m_fDying)
	{
		m_fDying += fDelta;

		if( m_fDying > m_fDieTime )
		{
			CGame::GetInstance()->GetOF()->Destroy(this);
			SetIsActive(false);
		}
		float animTime = GetAnimationTime();
		animTime += fDelta;
		if(animTime > m_fDieTime)
			animTime = m_fDieTime;
		CAnimationProcessor::UpdateTime(GetCurrentAnimation(), animTime);
		CAnimationProcessor::Interpolator(GetCurrentAnimation(), animTime, PassCurrFrame());
		SetAnimationTime(animTime);
		return;
	}

	if(m_bDontDropPool && m_fDropWait > 0.0f)
	{
		m_fDropWait -= fDelta;
		if(m_fDropWait <= 0.0f)
		{
			m_fDropWait = 0.0f;
			m_bDontDropPool = false;
		}
	}

	KillCurrFrame();

	if(GetWasHit() == true)
	{
		float ftemp = GetHitDuration();
		ftemp += fDelta;
		SetHitDuration(ftemp);
		SetBeingHit(1);
		
		SetColor(COLOR_PATROLBOT_HIT);

		if(HIT_CAP < ftemp)
		{
			SetWasHit(false);
			SetHitDuration(0.0f);
			SetBeingHit(0);
			SetColor(COLOR_PATROLBOT);
		}
	}

	m_cAI.Update(fDelta);

	if( GetHealth() <= 0 )
	{
		WwiseNS::PlaySFX(WwiseNS::EVENT_SOUND_EXPLOSION);
		CGameplayState::GetInstance()->GetFX()->CreateEffect(EFFECT_DMGEXPLOSION,GetMatrix());
		if(!m_bDontDropPool)
		{
			CMoltenPool* pMoltenPool = nullptr;
			if(CGame::GetInstance()->GetOF()->Create(OBJ_POOL, (IBaseObject**)&pMoltenPool))
			{
				pMoltenPool->SetMatrix(GetMatrix());
				pMoltenPool->SetOriginalMatrix(GetMatrix());
				pMoltenPool->SetRadius(1.0f);
				pMoltenPool->SetScale(1.25f);
				pMoltenPool->SetScaleMod(1.4f);
				pMoltenPool->SetScaleTimer(1.0f);
				pMoltenPool->SetPoolStage(1);
				pMoltenPool->SetScalingMod(0.0f);
				pMoltenPool->SetDroppedID(1);
			}
		}
		CGameplayState::GetInstance()->GetFX()->CreateEffect(EFFECT_SMALLEXP,GetMatrix());
		SetBeingHit(0);
		TAnimation* tempAnim = CAssetManager::GetInstance()->GetAnimation(GetID(), 1);
		m_fDieTime = tempAnim->m_fDuration;
		m_fDying = .00001f;
		ChangeAnimation(1);
		SetAlive(false);
	}

	if(m_bCloseToTarget)
	{
		int nTemp = ((int)(m_fExplodeTimer*10)%2);

		float animTime = GetAnimationTime();
		animTime += fDelta;
		CAnimationProcessor::UpdateTime(GetCurrentAnimation(), animTime);
		CAnimationProcessor::Interpolator(GetCurrentAnimation(), animTime, PassCurrFrame());
		SetAnimationTime(animTime);

		if(nTemp)
			SetBeingHit(NOTHIT);
		else
			SetBeingHit(BURNEXPLODE);
	}
}