private void AddScenesViaPython() { var pythonScenesPath = (string)Config.Global.Python.Scenes; var pythonScenesScripts = Directory.GetFiles(pythonScenesPath, "*.py", SearchOption.TopDirectoryOnly); foreach (var pythonScript in pythonScenesScripts) { pythonScriptEngine.GetScriptEngine().ExecuteFile(pythonScript, scriptScope); } }
public void CreateSceneObjectsViaPython() { var pythonScenesPath = (string)Config.Global.Python.Scenes; var pythonScriptsPath = $"{pythonScenesPath}/{map}"; var pythonScripts = Directory.GetFiles(pythonScriptsPath, "*.py", SearchOption.AllDirectories); foreach (var pythonScript in pythonScripts) { pythonScriptEngine.GetScriptEngine().ExecuteFile(pythonScript, scriptScope); } }
public GameSceneWrapper(Maps map, Vector2 sceneSize, Vector2 regionSize) : base(sceneSize, regionSize) { this.map = map; pythonScriptEngine = ServerComponents.GetComponent <IPythonScriptEngine>().AssertNotNull(); characterSpawnDetailsProvider = ServerComponents.GetComponent <ICharacterSpawnDetailsProvider>().AssertNotNull(); scriptScope = pythonScriptEngine.GetScriptEngine().CreateScope(); scriptScope.SetVariable("scene", this); }
protected override void OnAwake() { base.OnAwake(); pythonScriptEngine = Components.GetComponent <IPythonScriptEngine>().AssertNotNull(); scriptScope = pythonScriptEngine.GetScriptEngine().CreateScope(); scriptScope.SetVariable("sceneContainer", this); AddScenesViaPython(); }