コード例 #1
0
ファイル: Projectile.cpp プロジェクト: mrG7/Rade
void AProjectile::Explode()
{
	BP_Explode();
	

	const FVector Loc = GetActorLocation();

	for (TActorIterator<AActor> aItr(GetWorld()); aItr; ++aItr)
	{
		const float distance = GetDistanceTo(*aItr);
		if (distance<AffectArea && aItr && aItr->GetRootComponent() && aItr->GetRootComponent()->Mobility == EComponentMobility::Movable)
		{
			FVector dir = aItr->GetActorLocation() - Loc;
			dir.Normalize();

			FRichCurve* RadialDamageCurveData = RadialDamageCurve.GetRichCurve();
			FRichCurve* RadialImpulseCurveData = RadialImpulseCurve.GetRichCurve();


			ABaseCharacter* theChar = Cast<ABaseCharacter>(*aItr);

			//If Player apply damage
			if (theChar && RadialDamageCurveData)
			{
				//printr("Apply Damage");
				UGameplayStatics::ApplyDamage(theChar, RadialDamageCurveData->Eval(distance), NULL, this, ExplosionDamageType);
			}
			
			if (RadialImpulseCurveData && aItr->GetRootComponent()->IsSimulatingPhysics() && Cast<UPrimitiveComponent>(aItr->GetRootComponent()))
			{
				Cast<UPrimitiveComponent>(aItr->GetRootComponent())->AddImpulse(dir*RadialImpulseCurveData->Eval(distance));
				
			}
		}

	}




	Destroy();
}
コード例 #2
0
float FCurveTableRowHandle::Eval(float XValue) const
{
	SCOPE_CYCLE_COUNTER(STAT_CurveTableRowHandleEval); 

	FRichCurve* Curve = GetCurve();
	if(Curve != NULL)
	{
		return Curve->Eval(XValue);
	}

	return 0;
}
コード例 #3
0
bool FCurveTableRowHandle::Eval(float XValue, float* YValue) const
{
	SCOPE_CYCLE_COUNTER(STAT_CurveTableRowHandleEval); 

	FRichCurve* Curve = GetCurve();
	if(Curve != NULL && YValue != NULL)
	{
		*YValue = Curve->Eval(XValue);
		return true;
	}

	return false;
}