You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.1 KiB
Plaintext
58 lines
1.1 KiB
Plaintext
|
3 years ago
|
/******************************************************************************
|
||
|
|
* 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()
|