Class DefaultScriptBehaviorController<T extends IEntity>
- Type Parameters:
T- the type of controlled entity
- All Implemented Interfaces:
IBehaviorController, IEntityController, IUpdateable
public class DefaultScriptBehaviorController<T extends IEntity>
extends Object
implements IBehaviorController
A default behavior controller that loads and manages entity scripts internally.
This controller encapsulates script bindings and delegates execution to an internal
EntityScriptController, allowing entity behavior to be driven dynamically by runtime scripts.
-
Field Summary
Fields inherited from interface IUpdateable
DEFAULT_UPDATE_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionDefaultScriptBehaviorController(T entity) DefaultScriptBehaviorController(T entity, String... scriptIds) DefaultScriptBehaviorController(T entity, Collection<ScriptBinding> bindings) -
Method Summary
Modifier and TypeMethodDescriptionvoidattach()voiddetach()Returns an unmodifiable list of script bindings currently loaded by this controller.Returns the internalEntityScriptControllermanaging the script instances.voidloadScript(ScriptBinding binding) Loads a script with specific bindings and configuration parameters.voidloadScript(String scriptId) Loads a script by its definition ID with default parameters.voidloadScripts(Collection<ScriptBinding> bindings) Loads multiple script bindings.voidUnloads all scripts currently loaded by this behavior controller.voidunloadScript(String scriptId) Unloads a script by its definition ID.voidupdate()This method is called by the game loop on all objects that are attached to the loop.protected voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IUpdateable
getUpdatePriority
-
Constructor Details
-
DefaultScriptBehaviorController
-
DefaultScriptBehaviorController
-
DefaultScriptBehaviorController
-
-
Method Details
-
getEntity
- Specified by:
getEntityin interfaceIEntityController
-
getScriptController
Returns the internalEntityScriptControllermanaging the script instances.- Returns:
- the script controller
-
loadScript
Loads a script by its definition ID with default parameters.- Parameters:
scriptId- the script definition ID to load
-
loadScript
Loads a script with specific bindings and configuration parameters.- Parameters:
binding- the script binding to load
-
loadScripts
Loads multiple script bindings.- Parameters:
bindings- the script bindings to load
-
unloadScript
Unloads a script by its definition ID.- Parameters:
scriptId- the script definition ID to unload
-
unloadAllScripts
public void unloadAllScripts()Unloads all scripts currently loaded by this behavior controller. -
getLoadedScripts
Returns an unmodifiable list of script bindings currently loaded by this controller.- Returns:
- the loaded script bindings
-
attach
public void attach()- Specified by:
attachin interfaceIBehaviorController- Specified by:
attachin interfaceIEntityController
-
detach
public void detach()- Specified by:
detachin interfaceIBehaviorController- Specified by:
detachin interfaceIEntityController
-
update
public void update()Description copied from interface:IUpdateableThis method is called by the game loop on all objects that are attached to the loop. It's called on every tick of the loop and the frequency can be configured using theClientConfiguration.- Specified by:
updatein interfaceIUpdateable- See Also:
-
updateBehavior
-