void CFireBallProjectile::Update()
{
	if (checkCol) {
		pos += speed;

		if (weaponDef->gravityAffected)
			speed.y += mapInfo->map.gravity;

		// g�ra om till ttl sedan kanske
		if (weaponDef->noExplode) {
			if (TraveledRange())
				checkCol = false;
		}

		EmitSpark();
	}
	else {
		if (sparks.size() == 0)
			deleteMe = true;
	}

	for (unsigned int i = 0; i < sparks.size(); i++) {
		sparks[i].ttl--;
		if (sparks[i].ttl == 0) {
			sparks.pop_back();
			break;
		}
		if (checkCol)
			sparks[i].pos += sparks[i].speed;
		sparks[i].speed *= 0.95f;
	}

	if (cegTag.size() > 0) {
		ceg.Explosion(pos, ttl, (sparks.size() > 0)? sparks[0].size: 0.0f, 0x0, 0.0f, 0x0, speed);
	}

	UpdateGroundBounce();
}
예제 #2
0
void CFireBallProjectile::Update()
{
	if (checkCol) {
		if (!luaMoveCtrl) {
			pos += speed;

			if (weaponDef->gravityAffected) {
				speed.y += mygravity;
			}
		}

		if (weaponDef->noExplode && TraveledRange()) {
			checkCol = false;
		}

		EmitSpark();
	} else {
		if (sparks.empty()) {
			deleteMe = true;
		}
	}

	for (unsigned int i = 0; i < sparks.size(); i++) {
		sparks[i].ttl--;
		if (sparks[i].ttl == 0) {
			sparks.pop_back();
			break;
		}
		if (checkCol) {
			sparks[i].pos += sparks[i].speed;
		}
		sparks[i].speed *= 0.95f;
	}

	gCEG->Explosion(cegID, pos, ttl, !sparks.empty() ? sparks[0].size : 0.0f, NULL, 0.0f, NULL, speed);
	UpdateGroundBounce();
	UpdateInterception();
}
void CFireBallProjectile::Update()
{
	if(checkCol)
	{
		pos+=speed;

		if(weaponDef->gravityAffected)
			speed.y+=gs->gravity;

		//göra om till ttl sedan kanske
		if(weaponDef->noExplode)
		{
			if(TraveledRange())
				checkCol=false;
		}

		EmitSpark();
	}
	else
	{
		if(sparks.size()==0)
			deleteMe = true;
	}

	for(unsigned int i=0; i<sparks.size(); i++)
	{
		sparks[i].ttl--;
		if(sparks[i].ttl==0){
			sparks.pop_back();
			break;
		}
		if(checkCol)
			sparks[i].pos += sparks[i].speed;
		sparks[i].speed *= 0.95f;
	}
}