本文整理汇总了C#中CPos.Last方法的典型用法代码示例。如果您正苦于以下问题:C# CPos.Last方法的具体用法?C# CPos.Last怎么用?C# CPos.Last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPos
的用法示例。
在下文中一共展示了CPos.Last方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReinforceWithTransport
public LuaTable ReinforceWithTransport(Player owner, string actorType, string[] cargoTypes, CPos[] entryPath, CPos[] exitPath = null,
LuaFunction actionFunc = null, LuaFunction exitFunc = null)
{
var transport = CreateActor(owner, actorType, true, entryPath[0], entryPath.Length > 1 ? entryPath[1] : (CPos?)null);
var cargo = transport.TraitOrDefault<Cargo>();
var passengers = new List<Actor>();
if (cargo != null && cargoTypes != null)
{
foreach (var cargoType in cargoTypes)
{
var passenger = CreateActor(owner, cargoType, false, entryPath[0]);
passengers.Add(passenger);
cargo.Load(transport, passenger);
}
}
for (var i = 1; i < entryPath.Length; i++)
Move(transport, entryPath[i]);
if (actionFunc != null)
{
var af = actionFunc.CopyReference() as LuaFunction;
transport.QueueActivity(new CallFunc(() =>
{
af.Call(transport.ToLuaValue(Context), passengers.ToArray().ToLuaValue(Context));
af.Dispose();
}));
}
else
{
var aircraftInfo = transport.TraitOrDefault<Aircraft>();
if (aircraftInfo != null)
{
if (!aircraftInfo.IsPlane)
{
transport.QueueActivity(new Turn(transport, aircraftInfo.Info.InitialFacing));
transport.QueueActivity(new HeliLand(transport, true));
}
else
{
transport.QueueActivity(new Land(transport, Target.FromCell(transport.World, entryPath.Last())));
}
transport.QueueActivity(new Wait(15));
}
if (cargo != null)
{
transport.QueueActivity(new UnloadCargo(transport, true));
transport.QueueActivity(new WaitFor(() => cargo.IsEmpty(transport)));
}
transport.QueueActivity(new Wait(aircraftInfo != null ? 50 : 25));
}
if (exitFunc != null)
{
var ef = exitFunc.CopyReference() as LuaFunction;
transport.QueueActivity(new CallFunc(() =>
{
ef.Call(transport.ToLuaValue(Context));
ef.Dispose();
}));
}
else if (exitPath != null)
{
foreach (var wpt in exitPath)
Move(transport, wpt);
transport.QueueActivity(new RemoveSelf());
}
var ret = Context.CreateTable();
ret.Add(1, transport.ToLuaValue(Context));
ret.Add(2, passengers.ToArray().ToLuaValue(Context));
return ret;
}