public static PicoScript Load(PicoGame game, byte[] scriptData) { PicoScript script = null; Assembly gameAssembly = Assembly.Load(scriptData); Type picoScriptType = gameAssembly.GetTypes().First( myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(PicoScript)) ); if (picoScriptType != null) { script = (PicoScript)Activator.CreateInstance(picoScriptType); script.__SetGameReference(game); } return(script); }
public void __SetGameReference(PicoGame game) { Game = game; }