本文整理汇总了C#中MiNET.Worlds.Level.RelayBroadcast方法的典型用法代码示例。如果您正苦于以下问题:C# Level.RelayBroadcast方法的具体用法?C# Level.RelayBroadcast怎么用?C# Level.RelayBroadcast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MiNET.Worlds.Level
的用法示例。
在下文中一共展示了Level.RelayBroadcast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Spawn
public virtual void Spawn(Level level)
{
McpeLevelEvent levelEvent = McpeLevelEvent.CreateObject();
levelEvent.eventId = Id;
levelEvent.data = Pitch;
levelEvent.x = (float) Position.X;
levelEvent.y = (float) Position.Y;
levelEvent.z = (float) Position.Z;
level.RelayBroadcast(levelEvent);
}
示例2: OnTick
public override void OnTick(Level level)
{
if (Inventory == null) return;
Furnace furnace = level.GetBlock(Coordinates) as Furnace;
if (furnace == null) return;
if (!(furnace is LitFurnace))
{
if (GetFuel().Id != 0)
{
LitFurnace litFurnace = new LitFurnace
{
Coordinates = furnace.Coordinates,
Metadata = furnace.Metadata
};
level.SetBlock(litFurnace);
furnace = litFurnace;
BurnTime = GetFuelEfficiency(GetFuel());
FuelEfficiency = BurnTime;
CookTime = 0;
Inventory.DecreaseSlot(1);
}
}
if (!(furnace is LitFurnace)) return;
if (BurnTime > 0)
{
BurnTime--;
BurnTick = (short) Math.Ceiling((double) BurnTime/FuelEfficiency*200d);
if (GetIngredient().Id != 0)
{
CookTime++;
if (CookTime >= 200)
{
Item result = GetResult(GetIngredient());
if (result != null)
{
Inventory.DecreaseSlot(0);
Inventory.IncreaseSlot(2, result.Id, result.Metadata);
}
CookTime = 0;
}
}
else
{
CookTime = 0;
}
}
if (BurnTime <= 0)
{
if (!Inventory.DecreaseSlot(1))
{
//CookTime = 0;
BurnTime = GetFuelEfficiency(GetFuel());
FuelEfficiency = BurnTime;
BurnTick = (short) Math.Ceiling((double) BurnTime/FuelEfficiency*200d);
}
else
{
// No more fule
Furnace unlitFurnace = new Furnace
{
Coordinates = furnace.Coordinates,
Metadata = furnace.Metadata
};
level.SetBlock(unlitFurnace);
FuelEfficiency = 0;
BurnTick = 0;
BurnTime = 0;
CookTime = 0;
}
}
level.RelayBroadcast(new McpeContainerSetData
{
windowId = Inventory.WindowsId,
property = 0,
value = CookTime
});
level.RelayBroadcast(new McpeContainerSetData
{
windowId = Inventory.WindowsId,
property = 1,
value = BurnTick
});
}
示例3: GenerateParticles
private void GenerateParticles(Random random, Level level, PlayerLocation point, float yoffset, Vector3 multiplier, double d)
{
float vx = (float) random.NextDouble();
vx *= random.Next(2) == 0 ? 1 : -1;
vx *= (float) multiplier.X;
float vy = (float) random.NextDouble();
//vy *= random.Next(2) == 0 ? 1 : -1;
vy *= (float) multiplier.Y;
float vz = (float) random.NextDouble();
vz *= random.Next(2) == 0 ? 1 : -1;
vz *= (float) multiplier.Z;
McpeLevelEvent mobParticles = McpeLevelEvent.CreateObject();
mobParticles.eventId = (short) (0x4000 | GetParticle(random.Next(0, m < 1 ? 2 : 5)));
mobParticles.x = point.X + vx;
mobParticles.y = (point.Y - 2) + yoffset + vy;
mobParticles.z = point.Z + vz;
level.RelayBroadcast(mobParticles);
}