Weapons
160
{
if ( bTargetLockingActive && ( WorldInfo.TimeSeconds >
LastTargetLockCheckTime + LockCheckTime ) )
{
LastTargetLockCheckTime = WorldInfo.TimeSeconds;
// Time, in seconds, since level began play
CheckTargetLock();
// Checks to see if we are locked on a target
}
}
- As I mentioned earlier, we can only lock onto pawns. Therefore, we need a function
to check whether or not our target is a pawn.
/****- Given an potential target TA determine if we can lock on to it.
By - default, we can only lock on to pawns.
****/
simulated function bool CanLockOnTo(Actor TA)
{
if ( (TA == None) || !TA.bProjTarget || TA.bDeleteMe ||
(Pawn(TA) == None) || (TA == Instigator) ||
(Pawn(TA).Health <= 0) )
{
return false;
}
return ( (WorldInfo.Game == None) ||
!WorldInfo.Game.bTeamGame || (WorldInfo.GRI == None) ||
!WorldInfo.GRI.OnSameTeam(Instigator,TA) );
}
- Given an potential target TA determine if we can lock on to it.
- Once we have a locked target we need to trigger a sound, so that the player is
aware of the lock. The whole first half of this function simply sets two variables
to not have a target, and also plays a sound cue to notify the player that we've
lost track of our target.
/****- Used to adjust the LockTarget.
****/
function AdjustLockTarget(actor NewLockTarget)
{
if ( LockedTarget == NewLockTarget )
{
// No need to update
return;
}
- Used to adjust the LockTarget.