By VitalOverdose
class SFx_Boosting Extends SmartFx
placeable;
struct VecRec
{
var OnsVehicle VevRef;
Var float RecTime;
};Var Array< VecRec > Tracking;
var bool bTracking;
var int TotalParticles;
var () float CaptureTime;
Var () int ActiveEmitterNumb;
Var () int TimerFrequency;
Var () float ScanSize;
Var (Boost) bool bCuasesBoost_Player;
Var (Boost) bool bLocks_Player;
Var (Boost) bool bCuasesBoost_Bot;
Var (Boost) bool bbLocks_Bot;
var (Boost) sound VocBoost;
var (boost) vector AppliedBoostForce;
Simulated Function PostBeginPlay()
{
if ( Emitters[ActiveEmitterNumb].MaxParticles > 10)
Destroyed();
if (AppliedBoostForce == Vect(0,0,0))
AppliedBoostForce.X=9000000.000000;
Super.PostBeginPlay();
}
Function tick(Float deltaTime)
{
local ONSvehicle FoundONSvec;
Local Int Counter;
for ( Counter=0 ; Counter < Emitters[0].Particles.Length ; Counter++ )
{
foreach visiblecollidingActors(Class'ONSvehicle', FoundONSvec , ScanSize , Emitters[ActiveEmitterNumb].Particles[Counter].Location )
{
VecBoost(FoundONSvec);
}
}
}
Simulated Function VecBoost( OnsVehicle TheVec )
{
Local Vector PointOfBoostForce;
Local Actor RotRelation;
EnterVecRec( TheVec );
if ( bDirectional)
RotRelation = self ;
else
RotRelation = TheVec;
TheVec.KAddImpulse( AppliedBoostForce >> RotRelation.Rotation, PointOfBoostForce >> RotRelation.Rotation ) ;
}
Function enterVecRec( ONSVehicle NewVec )
{
Tracking.insert(0,1);
Tracking[0].VevRef = NewVec;
Tracking[0].RecTime = CaptureTime;
if ( Tracking.Length != 1 )
Return;
if ( NewVec.Driver.IsA('xBot'))
NewVec.bDriverCannotLeaveVehicle= True;
If (bTracking == false )
{
bTracking = True;
SetTimer(TimerFrequency,True);
}
}
Function Timer()
{
Local Int Counter;
for ( Counter=0; Counter<Tracking.Length; Counter++ )
{
Tracking[Counter].recTime -= TimerFrequency;
if (Tracking[Counter].recTime<TimerFrequency)
{
Tracking[Counter].VevRef.bDriverCannotLeaveVehicle = False ;
Tracking.remove( Counter , 1);
if (Tracking.Length==0)
{
bTracking = False;
disable('Timer');
}
}
}
}
Simulated Function postboost(Vehicle TheBoostedvec)
{
if ( VocBoost!= None )
PlaySound (VocBoost) ;
}
Related Topics
discusion
Category Custom Class