Beispiel #1
0
void ege::Element::setFireOn(int32_t _groupIdSource, int32_t _type, float _power, const vec3& _center) {
	float previousLife = m_life;
	m_life += _power;
	m_life = std::avg(0.0f, m_life, m_lifeMax);
	if (m_life <= 0) {
		EGE_DEBUG("[" << getUID() << "] element is killed ..." << getType());
	}
	if (m_life != previousLife) {
		onLifeChange();
	}
}
/*---------------------------------------------------------------------*//**
	フレーム制御
**//*---------------------------------------------------------------------*/
void StatGauge::exec(ExecRes* res, const ExecCtx* ec)
{
	if(_cstatRef == 0L)	
	{
		return;
	}

	// 値の更新
	s32 lv = _cstatRef->getLevel();
	if(_lvPrev != _cstatRef->getLevel())
	{
		_lvPrev = lv;
		resetAllGaugeAnim();	// 全アニメーションリセット
	}
	else
	{
		s32 lfene = _cstatRef->getEnergy();
		if(_lfenePrev != lfene)
		{
			onLifeChange(lfene, _lfenePrev);
			_lfenePrev = lfene;
		}
		s32 depthConc = _cstatRef->getConcentrateDepth();
		if(_depthConcPrev != depthConc)
		{
#if 1
			onConcentrateChange(depthConc, _depthConcPrev);
			_depthConcPrev = depthConc;
#else
			s32 n = (s32)((depthConc - _depthConcDisp) * 0.0625f * ec->getDeltaFrame());
			_depthConcDisp += n;
#endif
		}
		u16 cntCharge = _cstatRef->getChargeCounter();
		if(_cntChargePrev != cntCharge)
		{
#if 1
			onChargeChange(cntCharge, _cntChargePrev);
			_cntChargePrev = cntCharge;
#else
			s32 n = (s32)((cntCharge - _cntChargeDisp) * 0.0625f * ec->getDeltaFrame());
			_cntChargeDisp += n;
#endif
		}
	}

	// アニメーション制御
	for(int i = 0; i < NUM_SLOTS; i++)
	{
		if(_slotGa[i]._kind == GAK_NULL) { continue; }
		_slotGa[i]._fcntAnim += ec->getDeltaFrame();
		if(_slotGa[i]._fcntAnim >= FCNT_CHANGE_ANIM_NUM)
		{
			_slotGa[i]._fcntAnim = -1.0f;
			if(_slotGa[i]._fcntAnim <= 0.0f)
			{
				_slotGa[i]._kind = GAK_NULL;
			}
		}
	}
}