updateEntity method
Updates the partitioning index of a given game entity.
Implementation
int updateEntity(GameEntity entity, [int currentIndex = - 1 ]) {
final newIndex = getIndexForPosition( entity.position );
if ( currentIndex != newIndex ) {
addEntityToPartition( entity, newIndex );
if ( currentIndex != - 1 ) {
removeEntityFromPartition( entity, currentIndex );
}
}
return newIndex;
}