event TakeDamage (int DamageAmount, Controller EventInstigator, Object.Vector HitLocation, Object.Vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
local MaterialInstanceConstant tmpMIC;
local StaticMeshComponent tmp;
local LinearColor tmpHitLoc, tmpTiling;
tmp = new () class'StaticMeshComponent';
tmp.SetStaticMesh(StaticMesh'Shield.ShieldMesh');
// tmp.SetStaticMesh(StaticMeshComponent(Mesh).StaticMesh);
// tmp.;
// tmp.bAcceptsDynamicDecals=false;
tmpMIC = new(None) Class'MaterialInstanceConstant';
tmpMIC.SetParent(ShieldImpactMICPreset);
tmpHitLoc=MakeLinearColor(HitLocation.X-Location.X-tmp.Translation.X,HitLocation.Y-Location.Y-tmp.Translation.Y,HitLocation.Z-Location.Z-tmp.Translation.Z,1);
tmpMIC.SetVectorParameterValue('ImpactPosition',tmpHitLoc);
tmpMIC.SetScalarParameterValue('ImpactTime',0);
tmpMIC.SetScalarParameterValue('ImpactRadius',ImpactRadius);
tmpMIC.SetScalarParameterValue('EdgeSharpness',EdgeSharpness);
tmpMIC.SetVectorParameterValue('Color',ShieldColor);
tmpTiling = MakeLinearColor(Tiling.X,Tiling.Y,0,0);
tmpMIC.SetVectorParameterValue('Tiling',tmpTiling);
tmp.SetMaterial(0,tmpMIC);
// tmp.SetScale3D(vect(10,10,10));
AttachComponent(tmp);
Impacts.AddItem(tmp);
ImpactMICs.AddItem(tmpMIC);
}
simulated function Tick(Float Delta)
{
local int i;
local float ImpactTime;
Super.Tick(Delta);
For(i=0;i<ImpactMICs.Length;i++)
{
if(ImpactMICs[i].GetScalarParameterValue('ImpactTime',ImpactTime))
{
ImpactTime+=Delta*ImpactDissolveSpeed;
ImpactMICs[i].SetScalarParameterValue('ImpactTime',ImpactTime);
if(ImpactTime>1)
{
DetachComponent(Impacts[i]);
Impacts.RemoveItem(Impacts[i]);
ImpactMICs.RemoveItem(ImpactMICs[i]);
i--; //Kinda ugly :D
}
}
}
}