Skip to content

Instantly share code, notes, and snippets.

@terryjsmith
Created September 15, 2016 00:09
Show Gist options
  • Save terryjsmith/c454424e0db892b92a553d2db3b91161 to your computer and use it in GitHub Desktop.
Save terryjsmith/c454424e0db892b92a553d2db3b91161 to your computer and use it in GitHub Desktop.
void ScriptSystem::Update(float delta) {
// Global updates
ScriptTime::SetDelta(delta);
for(int i = 0; i < m_scriptablePoolSize; i++) {
if(m_scriptables[i]) {
// Set global script variables
m_currentObject = m_scriptables[i];
Entity* obj = m_currentObject->GetParent();
MeshInstance* instance = (MeshInstance*)obj->FindComponent<MeshInstance>();
ScriptTransform::SetMeshInstance(instance);
// Execute script
Script* script = m_scriptables[i]->GetScript();
script->Execute();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment