safe update controllers

This commit is contained in:
2016-09-09 21:16:47 +07:00
parent b3783f22c4
commit 891c1790c3
3 changed files with 28 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ namespace FlashTools {
SwfAssocList<SwfClip> _clips = new SwfAssocList<SwfClip>();
SwfAssocList<SwfClipController> _controllers = new SwfAssocList<SwfClipController>();
SwfList<SwfClipController> _safeUpdates = new SwfList<SwfClipController>();
// ---------------------------------------------------------------------
//
@@ -92,8 +93,12 @@ namespace FlashTools {
void UpdateControllers() {
var dt = Time.deltaTime;
for ( int i = 0, e = _controllers.Count; i < e; ++i ) {
_controllers[i].InternalUpdate(dt);
_controllers.AssignTo(_safeUpdates);
for ( int i = 0, e = _safeUpdates.Count; i < e; ++i ) {
var ctrl = _safeUpdates[i];
if ( ctrl ) {
ctrl.InternalUpdate(dt);
}
}
}