Scripting support
Submitted by xen on Thu, 11/29/2007 - 18:27
I have just added a scripting system to the engine. Right now it supports Boo, but it will be extended to C# soon.
It uses coroutine in order to make scripting over frame/time very easy :
- "yield" will suspend execution until next frame.
- "yield StartCoroutine(coroutine)" will add a coroutine to the scheduler, and the calling coroutine won't be resumed before the called coroutine has finished.
- "yield Wait(3.5)" : the engine will wait for 3.5 seconds before resuming the coroutine
Simple example which move the camera every frame :
class Test(IScript): i = 0.0
def Run() as IEnumerator:
while true:
rvs = SceneDesignerContext.Services.GetService(typeof(IRenderViewService)) as IRenderViewService
rvs.Eye = Vector3(40 + i, 40, 40)
i += 0.01
yield
