Game Development Reference
In-Depth Information
Decaying auditory events
Now, we can update our
AgentSenses
update loop to prune both the
bulletImpacts
as well as
bulletShots
entries that are being stored on the blackboard. Pruning out old
events prevents Lua from consuming large amounts of data, as both of these event types
occur frequently:
AgentSenses.lua
:
function AgentSenses_UpdateSenses(
sandbox, userData, deltaTimeInMillis)
PruneBlackboardEvents(
userData.blackboard,
"bulletImpacts",
deltaTimeInMillis);
PruneBlackboardEvents(
userData.blackboard,
"bulletShots",
deltaTimeInMillis);
...
end