本文整理汇总了C#中MessagePackObject.Count方法的典型用法代码示例。如果您正苦于以下问题:C# MessagePackObject.Count方法的具体用法?C# MessagePackObject.Count怎么用?C# MessagePackObject.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessagePackObject
的用法示例。
在下文中一共展示了MessagePackObject.Count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// </summary>
/// <param name="self">
/// </param>
/// <param name="caller">
/// </param>
/// <param name="target">
/// </param>
/// <param name="arguments">
/// </param>
/// <returns>
/// </returns>
public override bool Execute(
INamedEntity self,
IEntity caller,
IInstancedEntity target,
MessagePackObject[] arguments)
{
if (arguments.Count() != 3)
{
return false;
}
uint arg1 = arguments[1].AsUInt32();
int toPlayfield = arguments[2].AsInt32();
byte destinationIndex = (byte)(arg1 >> 16);
PlayfieldData pfd = PlayfieldLoader.PFData[toPlayfield];
PlayfieldDestination pfDestination = pfd.Destinations[destinationIndex];
float newX = (pfDestination.EndX - pfDestination.StartX) * 0.5f + pfDestination.StartX;
float newZ = (pfDestination.EndZ - pfDestination.StartZ) * 0.5f + pfDestination.StartZ;
float dist = WallCollision.Distance(
pfDestination.StartX,
pfDestination.StartZ,
pfDestination.EndX,
pfDestination.EndZ);
float headDistX = (pfDestination.EndX - pfDestination.StartX) / dist;
float headDistZ = (pfDestination.EndZ - pfDestination.StartZ) / dist;
newX -= headDistZ * 4;
newZ += headDistX * 4;
Coordinate destCoordinate = new Coordinate(newX, pfDestination.EndY, newZ);
((ICharacter)self).Teleport(
destCoordinate,
((ICharacter)self).Heading,
new Identity() { Type = IdentityType.Playfield, Instance = toPlayfield });
return true;
}