0
我目前正在编写XNA中的RPG引擎。引擎执行一系列脚本命令,但必须阻塞,直到下一个脚本命令。我怎样才能做到这一点?XNA中的阻塞函数
例如:
// interact with an NPC named in String 'Name'
String interactfunc = String.Format("{0}_Interact", Name);
System.Reflection.MethodInfo info = Factory.Script.GetType().GetMethod(interactfunc);
if (info != null) info.Invoke(Factory.Script, new object[]{this});
//this may run the following script command for NPC 'Bob'
public void Bob_Interact(NPC Bob)
{
Bob.Say("Well this worked.");
Bob.Say("Didnt it?");
}
//the say command looks like this
public void Say(String Text)
{
TalkGui gui = new TalkGui(this, Text);
Factory.Game.Guis.Add(gui);
Factory.FocusedGui = gui;
}
现在我需要剧本的等待,直到第TalkGui已运行下一个脚本命令之前被解雇。
这样做的最好方法是什么?也许可以在自己的线程中运行脚本函数?