How do I communicate with an IronPython component in a C#/XNA game?
- by Jonathan Hobbs
My XNA game is component-oriented, and has various components for position, physics representation, rendering, etc, all of which extend a base Component class. The player and enemies also have controllers which are currently defined in C#. I'd like to turn them into Python scripts, but I'm not sure how to interact with those scripts.
The examples in Embedding IronPython in a C# Application suggest I'd have to create a wrapper class (e.g. a Script component) which compiles a Python script, and call the Update methods of the component in the script
Is this the most effective way of working with a Python object?
I feel that I'm missing something in my research - there must be a way to load up a script, instantiate a Python object and then work directly with it from within C#. Or is the wrapper required?