Game Development Reference
In-Depth Information
function PlayHit(float Damage, Controller InstigatedBy, vector
HitLocation, class<DamageType> damageType, vector Momentum,
TraceHitInfo HitInfo)
Super.PlayHit(Damage, InstigatedBy, HitLocation,
DamageType, Momentum, HitInfo);
// Calls flash timer
I may not have mentioned this before, so this is an excellent time to do so.
The Super function is used inside of a function, and calls the name of the
function it resides in from the parent class.
So in this example, Super is calling PlayHit from UTPawn , which is the
class TutorialPawn is extending from. It's useful when you only want to
add functionality to a function without overwriting what it does in the parent
Essentially, we're having it call our FlashDmgTimer() function each time the pawn
is hit. This checks if our pawn's health is below the highest threshold; in our case, this
is 50 percent health. If it is not, then the body material color is set to its default value.
Compile your project and either lower your own health down to 50 percent or less, or
do the same to another pawn. Watch as the red material flashes over their body, and
continues to do so more quickly as they reach the next threshold.
Search Nedrilad ::

Custom Search