UE2:WeaponFire (UT2004): Difference between revisions
From Unreal Wiki, The Unreal Engine Documentation Site
Auto-generated page |
m added native code snippet released by Epic Games |
||
Line 3: | Line 3: | ||
| parent1 = Object | | parent1 = Object | ||
}} | }} | ||
Abstract base class for weapon fire mode implementations. | |||
==Properties== | ==Properties== | ||
Line 109: | Line 108: | ||
==Functions== | ==Functions== | ||
===Native code=== | |||
====Fire mode updating==== | |||
<source lang="cpp"> | |||
void UWeaponFire::ModeTick( FLOAT DeltaSeconds ) | |||
{ | |||
guard(UWeaponFire::ModeTick); | |||
if ( !Weapon || Weapon->bDeleteMe || !Instigator || Instigator->bDeleteMe ) | |||
return; | |||
// WeaponFire timer | |||
if ( TimerInterval != 0.f ) | |||
{ | |||
if ( NextTimerPop < Level->TimeSeconds ) | |||
{ | |||
eventTimer(); | |||
if ( bTimerLoop ) | |||
NextTimerPop = NextTimerPop + TimerInterval; | |||
else | |||
TimerInterval = 0.f; | |||
} | |||
} | |||
eventModeTick(DeltaSeconds); | |||
FLOAT CurrentTime = Weapon->Level->TimeSeconds; | |||
if ( (bIsFiring && !bFireOnRelease) | |||
|| ((bInstantStop || !bIsFiring) && bFireOnRelease) | |||
|| (HoldTime > MaxHoldTime && MaxHoldTime > 0.0f) ) | |||
{ | |||
if (CurrentTime > NextFireTime && (bInstantStop || !bNowWaiting) ) | |||
{ | |||
eventModeDoFire(); | |||
if (bWaitForRelease) | |||
bNowWaiting = true; | |||
} | |||
} | |||
else if (bWaitForRelease && CurrentTime >= NextFireTime) | |||
{ | |||
bNowWaiting = false; | |||
if (HoldTime == 0.0f) | |||
eventModeHoldFire(); | |||
HoldTime += DeltaSeconds; | |||
} | |||
bInstantStop = false; | |||
unguard; | |||
} | |||
</source> | |||
===Events=== | ===Events=== | ||
====ModeDoFire==== | ====ModeDoFire==== |
Latest revision as of 03:11, 23 July 2008
Object >> WeaponFire |
- Package:
- Engine
- Direct subclasses:
- InstantFire, BallTarget, FM_Turret_Minigun_AltFire, FM_Turret_AltFire_Shield, ONSAVRiLAltFire, LinkFire, ONSGrenadeAltFire, ONSMineLayerAltFire, PainterFire, PainterZoom, ProjectileFire, ShieldAltFire, ShieldFire, SniperZoom, TransRecall
- This class in other games:
Abstract base class for weapon fire mode implementations.
Properties
Property group 'WeaponFire'
See WeaponFire property group WeaponFire.
Internal variables
bInstantStop
Type: bool
bIsFiring
Type: bool
bNowWaiting
Type: bool
bServerDelayStartFire
Type: bool
bServerDelayStopFire
Type: bool
bTimerLoop
Type: bool
FireCount
Type: int
Instigator
Type: Pawn
Level
Type: LevelInfo
NextFireTime
Type: float
NextTimerPop
Type: float
Owner
Type: Actor
SavedFireProperties
Type: Actor.FireProperties
ServerStartFireTime
Type: float
TimerInterval
Type: float
TransientSoundRadius
Type: float
Default value: 400.0
TransientSoundVolume
Type: float
Default value: 0.5
Enums
ESpreadStyle
- SS_None
- SS_Random
- spread is max random angle deviation
- SS_Line
- spread is angle between each projectile
- SS_Ring
Functions
Native code
Fire mode updating
void UWeaponFire::ModeTick( FLOAT DeltaSeconds )
{
guard(UWeaponFire::ModeTick);
if ( !Weapon || Weapon->bDeleteMe || !Instigator || Instigator->bDeleteMe )
return;
// WeaponFire timer
if ( TimerInterval != 0.f )
{
if ( NextTimerPop < Level->TimeSeconds )
{
eventTimer();
if ( bTimerLoop )
NextTimerPop = NextTimerPop + TimerInterval;
else
TimerInterval = 0.f;
}
}
eventModeTick(DeltaSeconds);
FLOAT CurrentTime = Weapon->Level->TimeSeconds;
if ( (bIsFiring && !bFireOnRelease)
|| ((bInstantStop || !bIsFiring) && bFireOnRelease)
|| (HoldTime > MaxHoldTime && MaxHoldTime > 0.0f) )
{
if (CurrentTime > NextFireTime && (bInstantStop || !bNowWaiting) )
{
eventModeDoFire();
if (bWaitForRelease)
bNowWaiting = true;
}
}
else if (bWaitForRelease && CurrentTime >= NextFireTime)
{
bNowWaiting = false;
if (HoldTime == 0.0f)
eventModeHoldFire();
HoldTime += DeltaSeconds;
}
bInstantStop = false;
unguard;
}
Events
ModeDoFire
event ModeDoFire ()
ModeHoldFire
event ModeHoldFire ()
ModeTick
event ModeTick (float dt)
SetInitialState
simulated event SetInitialState ()
Timer
event Timer ()