本文整理汇总了C#中Simulator类的典型用法代码示例。如果您正苦于以下问题:C# Simulator类的具体用法?C# Simulator怎么用?C# Simulator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Simulator类属于命名空间,在下文中一共展示了Simulator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBookWrittenCallback
public static ObjectGuid CreateBookWrittenCallback(object customData, ref Simulator.ObjectInitParameters initData, Quality quality)
{
BookWrittenData data = customData as BookWrittenData;
if (data == null) return ObjectGuid.InvalidObjectGuid;
try
{
Notify(data.Title);
BookWritten book = GlobalFunctions.CreateObjectOutOfWorld("BookWritten") as BookWritten;
if (book == null)
{
return ObjectGuid.InvalidObjectGuid;
}
book.InitBookCommon(data);
return book.ObjectId;
}
catch(Exception e)
{
Common.Exception(data.ID, e);
return ObjectGuid.InvalidObjectGuid;
}
}
示例2: Objects_OnObjectUpdated
private void Objects_OnObjectUpdated(Simulator simulator, ObjectUpdate update, ulong regionHandle, ushort timeDilation)
{
if (startTime == 0) return;
if (update.LocalID == Client.Self.LocalID)
{
XYMovement();
ZMovement();
if (Client.Self.Movement.AtPos || Client.Self.Movement.AtNeg)
{
Client.Self.Movement.TurnToward(target);
Debug("Flyxy ");
}
else if (Client.Self.Movement.UpPos || Client.Self.Movement.UpNeg)
{
Client.Self.Movement.TurnToward(target);
//Client.Self.Movement.SendUpdate(false);
Debug("Fly z ");
}
else if (Vector3.Distance(target, Client.Self.SimPosition) <= 2.0)
{
EndFlyto();
Debug("At Target");
}
}
if (Environment.TickCount - startTime > duration)
{
EndFlyto();
Debug("End Flyto");
}
}
示例3: RingTest
/// <summary>First half builds the ring, second half tests the connection handler...</summary>
public void RingTest() {
Parameters p = new Parameters("Test", "Test");
string[] args = "-b=.2 -c --secure_senders -s=50".Split(' ');
Assert.AreNotEqual(-1, p.Parse(args), "Unable to parse" + p.ErrorMessage);
Simulator sim = new Simulator(p);
_sim = sim;
Assert.IsTrue(sim.Complete(true), "Simulation failed to complete the ring");
SimpleTimer.RunSteps(fifteen_mins, false);
var nm0 = sim.TakenIDs.Values[0];
int idx = 1;
NodeMapping nm1 = null;
do {
nm1 = sim.TakenIDs.Values[idx++];
} while(Simulator.AreConnected(nm0.Node, nm1.Node) && idx < sim.TakenIDs.Count);
Assert.IsFalse(Simulator.AreConnected(nm0.Node, nm1.Node), "Sanity check");
var ptype = new PType("chtest");
var ch0 = new ConnectionHandler(ptype, (StructuredNode) nm0.Node);
var ch1 = new ConnectionHandler(ptype, (StructuredNode) nm1.Node);
ConnectionHandlerTest(nm0.Node, nm1.Node, ch0, ch1);
SimpleTimer.RunSteps(fifteen_mins * 2, false);
Assert.IsFalse(Simulator.AreConnected(nm0.Node, nm1.Node), "Sanity check0");
ptype = new PType("chtest1");
ch0 = new SecureConnectionHandler(ptype, (StructuredNode) nm0.Node, nm0.Sso);
ch1 = new SecureConnectionHandler(ptype, (StructuredNode) nm1.Node, nm1.Sso);
ConnectionHandlerTest(nm0.Node, nm1.Node, ch0, ch1);
}
示例4: LoadUtilityFuncLib
public static UtilityFuncLib LoadUtilityFuncLib(string file, Simulator sim)
{
Assembly utilFile;
UtilityFuncLib lib;
try
{
utilFile = Assembly.LoadFrom(file);
Type mainType;
foreach (Type t in utilFile.GetTypes())
{
if (t.Name == "UtilityFuncMain")
{
mainType = t;
lib = (UtilityFuncLib)Activator.CreateInstance(mainType, sim);
return lib;
}
}
}
catch (ApplicationException ex)
{
// Error loading utility func library
}
return null;
}
示例5: InfiniteWave
public InfiniteWave(Simulator simulator, DescriptorInfiniteWaves descriptor)
{
Simulator = simulator;
Descriptor = descriptor;
NbWavesAsked = 0;
ActualDifficulty = Descriptor.StartingDifficulty - Descriptor.DifficultyIncrement;
}
示例6: CreateObjectWithOverrides
private static IGameObject CreateObjectWithOverrides(ulong instance, ProductVersion version, Vector3 initPos, int level, Vector3 initFwd, Hashtable overrides, Simulator.ObjectInitParameters initData)
{
GlobalFunctions.FillInInitData(initPos, level, initFwd, ref initData);
IGameObject createdObject = CreateObjectInternal(instance, version, overrides, initData);
GlobalFunctions.CheckForFailure(createdObject, "Missing object resource instance " + instance + Common.NewLine);
return createdObject;
}
示例7: Ai
public Ai(Simulator simulator)
{
this.simulator = simulator;
this.ticks = simulator.Ticks;
kruispunten = new List<IKruispuntType>();
// maak een initial state aan
foreach (IKruispunt kruispunt in this.simulator.Kruispunten)
{
if (kruispunt is Type1)
{
kruispunten.Add(new KruispuntType1(kruispunt, simulator));
}
else if (kruispunt is Type2)
{
kruispunten.Add(new KruispuntType2(kruispunt, simulator));
}
else if (kruispunt is Type3)
{
kruispunten.Add(new KruispuntType3(kruispunt, simulator));
}
else if (kruispunt is Type4)
{
kruispunten.Add(new KruispuntType4(kruispunt, simulator));
}
}
// register event handlers
this.simulator.postSimulate += new EventHandler(simulator_postSimulate);
this.simulator.preSimulate += new EventHandler(simulator_preSimulate);
}
示例8: StandardInteractionProvider
public StandardInteractionProvider(Simulator simulator, AbstractWindowsEnvironment environmentInterface,
out Action cancelCallback)
{
this.simulator = simulator;
this.environmentInterface = environmentInterface;
cancelCallback = HandleCancelCallback;
}
示例9: SimulatorSpell
public SimulatorSpell (Simulator sim, string name)
: base(name)
{
Contract.Requires(sim != null);
Contract.Requires(!string.IsNullOrEmpty(name));
Sim = sim;
}
示例10: ShouldFinishWithConclusiveMatch
public void ShouldFinishWithConclusiveMatch()
{
var match = A.Match.Build();
var simulator = new Simulator(randomizer);
simulator.Play(match);
Assert.That(match.IsConclusive, Is.True);
}
示例11: ShouldFinishWithInactiveMatch
public void ShouldFinishWithInactiveMatch()
{
var match = A.Match.Build();
var simulator = new Simulator(randomizer);
simulator.Play(match);
Assert.That(match.IsActive, Is.False);
}
示例12: ShouldGenerateMatchResult
public void ShouldGenerateMatchResult()
{
var match = A.Match.Build();
var simulator = new Simulator(randomizer);
var result = simulator.Play(match);
Assert.That(result, Is.Not.Null);
}
示例13: Main
static void Main(string[] args)
{
var limitOrderBook = new StandardLimitOrderBook();
var commsModule = SignalRCommunicationsHandler.Instance;
var simulator = new Simulator(limitOrderBook, commsModule, commsModule);
System.Console.ReadKey();
}
示例14: SimulatorInputInterface
public SimulatorInputInterface(Simulator.OurSimulator os)
: base()
{
//For conversion into controller units
worldWidth = (os.Algo.dim[0] * 100) / this.scale;
worldHeight = (os.Algo.dim[1] * 100) / this.scale;
this.os = os;
}
示例15: CompleteTheDtlsRing
// [Test]
public void CompleteTheDtlsRing() {
Parameters p = new Parameters("Test", "Test");
string[] args = "-b=.2 --dtls -c --secure_edges -s=25".Split(' ');
Assert.AreNotEqual(-1, p.Parse(args), "Unable to parse" + p.ErrorMessage);;
Simulator sim = new Simulator(p);
Assert.IsTrue(sim.Complete(true), "Simulation failed to complete the ring");
sim.Disconnect();
}