Game Development Reference
In-Depth Information
/** Otherwise check to see if we have been
tracking the pending lock long enough */
else if (PendingLockedTarget == BestTarget
&& WorldInfo.TimeSeconds = PendingLockedTargetTime )
LastLockedOnTime = WorldInfo.TimeSeconds;
PendingLockedTarget = None;
PendingLockedTargetTime = 0.0;
Otherwise, if we can't lock onto our current or our pending target, then cancel
our current target, along with our pending target.
if ( LockedTarget != None&&((WorldInfo.TimeSeconds -
LastLockedOnTime > LockTolerance)||
!CanLockOnTo(LockedTarget)) )
// Invalidate the current locked Target
// Next attempt to invalidate the Pending Target
if ( PendingLockedTarget != None&&
((WorldInfo.TimeSeconds - LastValidTargetTime >
LockTolerance)||!CanLockOnTo(PendingLockedTarget)) )
// We are not pending another target to lock onto
PendingLockedTarget = None;
That was quite a bit to digest. Don't worry, because the functions from here on
out are pretty simple and straightforward.
As with most other classes, we need a Tick() function to check for something
in each frame. Here, we'll be checking whether or not we have a target locked in
each frame, as well as setting our LastTargetLockCheckTime to the number
of seconds passed during game-time.
* Check target locking with each update
event Tick( Float DeltaTime )
Search Nedrilad ::

Custom Search