protected internal virtual void Update( bool updateChildren, bool hasParentChanged )
{
isParentNotified = false;
// skip update if not needed
if ( !updateChildren && !needParentUpdate && !needChildUpdate && !hasParentChanged )
return;
// see if need to process everyone
if ( needParentUpdate || hasParentChanged )
{
// update transforms from parent
UpdateFromParent();
if ( NodeUpdated != null )
{
NodeUpdated( this );
}
}
// see if we need to process all
if ( needChildUpdate || hasParentChanged )
{
// update all children
foreach ( Node child in childNodes.Values )
{
child.Update( true, true );
}
childrenToUpdate.Clear();
}
else
{
// just update selected children
foreach ( Node child in childrenToUpdate.Values )
{
child.Update( true, false );
}
// clear the list
childrenToUpdate.Clear();
}
// reset the flag
needChildUpdate = false;
}