Foundation of wren scripting system
parent
5c9f2e0494
commit
dcd95ec685
@ -0,0 +1,58 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* File - world_interface.wren
|
||||||
|
* Author - Joey Pollack
|
||||||
|
* Date - 2022/11/16 (y/m/d)
|
||||||
|
* Mod Date - 2022/11/16 (y/m/d)
|
||||||
|
* Description - The main interface for scripts to interact with the game world
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
// Manages all of the EntityBehaviors
|
||||||
|
class WorldInterface {
|
||||||
|
|
||||||
|
static Init() {
|
||||||
|
__Behaviors = []
|
||||||
|
System.print("WorldInterface initialized")
|
||||||
|
}
|
||||||
|
|
||||||
|
static RegisterBehavior(behavior) {
|
||||||
|
__Behaviors.add(behavior)
|
||||||
|
// behavior.OnLoad()
|
||||||
|
}
|
||||||
|
|
||||||
|
static DoOnLoad() {
|
||||||
|
for (behavior in __Behaviors) {
|
||||||
|
behavior.OnLoad()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DoOnUnload() {
|
||||||
|
for (behavior in __Behaviors) {
|
||||||
|
behavior.OnUnload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Update(dt) {
|
||||||
|
//System.print("Updating %(__Behaviors.count) behaviors...")
|
||||||
|
for (behavior in __Behaviors) {
|
||||||
|
behavior.Update(dt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class EntityBehavior {
|
||||||
|
OnLoad() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
OnUnload() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Update(dt) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//WorldInterface.Init()
|
||||||
Loading…
Reference in New Issue