本文整理汇总了C#中IGame.Begin方法的典型用法代码示例。如果您正苦于以下问题:C# IGame.Begin方法的具体用法?C# IGame.Begin怎么用?C# IGame.Begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGame
的用法示例。
在下文中一共展示了IGame.Begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Begin
public void Begin()
{
simulation = new Simulation(Main.Content, new MISP.GenericScriptObject("episode-name", episodeName,
"server", true));
Main.Write("Started server simulation with episode " + episodeName + "\n");
simulation.modules.Add(serverModule);
simulation.beginSimulation();
clientGame = new ClientGame(System.Net.IPAddress.Loopback, port);
clientGame.Input = Input;
clientGame.Main = Main;
clientGame.Begin();
Main.ScriptEngine.PrepareEnvironment(simulation.scriptEngine);
Main.ScriptEngine.AddEnvironment("server", simulation.scriptEngine, simulation.scriptContext);
}
示例2: Update
protected override void Update(GameTime gameTime)
{
if (nextGame != null)
{
var saveActive = activeGame;
if (activeGame != null) activeGame.End();
activeGame = nextGame;
activeGame.Main = this;
activeGame.Input = Input;
try
{
activeGame.Begin();
}
catch (Exception e)
{
activeGame = saveActive;
if (activeGame != null) activeGame.Begin();
ReportException(e);
}
nextGame = null;
}
try
{
Input.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
if (activeGame != null) activeGame.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
injectedActionQueueLock.WaitOne();
injectedActionQueue.Swap();
foreach (var action in injectedActionQueue) action();
injectedActionQueue.ClearFront();
injectedActionQueueLock.ReleaseMutex();
}
catch (Exception e)
{
ReportException(e);
}
base.Update(gameTime);
}