本文整理汇总了C#中Level.PhysSandCheck方法的典型用法代码示例。如果您正苦于以下问题:C# Level.PhysSandCheck方法的具体用法?C# Level.PhysSandCheck怎么用?C# Level.PhysSandCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level.PhysSandCheck方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoWaterRandowFlow
static void DoWaterRandowFlow(Level lvl, Check C, Random rand) {
bool[] blocked = null;
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
if (!lvl.PhysSpongeCheck(C.b)) {
if (!lvl.liquids.TryGetValue(C.b, out blocked)) {
blocked = new bool[5];
lvl.liquids.Add(C.b, blocked);
}
byte block = lvl.blocks[C.b];
if (lvl.GetTile(x, (ushort)(y + 1), z) != Block.Zero) {
lvl.PhysSandCheck(lvl.PosToInt(x, (ushort)(y + 1), z));
}
if (!blocked[0] && rand.Next(4) == 0) {
lvl.PhysWater(lvl.PosToInt((ushort)(x + 1), y, z), block);
blocked[0] = true;
}
if (!blocked[1] && rand.Next(4) == 0) {
lvl.PhysWater(lvl.PosToInt((ushort)(x - 1), y, z), block);
blocked[1] = true;
}
if (!blocked[2] && rand.Next(4) == 0) {
lvl.PhysWater(lvl.PosToInt(x, y, (ushort)(z + 1)), block);
blocked[2] = true;
}
if (!blocked[3] && rand.Next(4) == 0) {
lvl.PhysWater(lvl.PosToInt(x, y, (ushort)(z - 1)), block);
blocked[3] = true;
}
if (!blocked[4] && rand.Next(4) == 0) {
lvl.PhysWater(lvl.PosToInt(x, (ushort)(y - 1), z), block);
blocked[4] = true;
}
if (!blocked[0] && WaterBlocked(lvl, (ushort)(x + 1), y, z))
blocked[0] = true;
if (!blocked[1] && WaterBlocked(lvl, (ushort)(x - 1), y, z))
blocked[1] = true;
if (!blocked[2] && WaterBlocked(lvl, x, y, (ushort)(z + 1)))
blocked[2] = true;
if (!blocked[3] && WaterBlocked(lvl, x, y, (ushort)(z - 1)))
blocked[3] = true;
if (!blocked[4] && WaterBlocked(lvl, x, (ushort)(y - 1), z))
blocked[4] = true;
} else { //was placed near sponge
lvl.liquids.TryGetValue(C.b, out blocked);
lvl.AddUpdate(C.b, Block.air);
if (C.extraInfo.IndexOf("wait") == -1)
C.time = 255;
}
if (C.extraInfo.IndexOf("wait") == -1 && blocked != null)
if (blocked[0] && blocked[1] && blocked[2] && blocked[3] && blocked[4])
{
lvl.liquids.Remove(C.b);
C.time = 255;
}
}
示例2: DoWaterUniformFlow
static void DoWaterUniformFlow(Level lvl, Check C, Random rand) {
lvl.liquids.Remove(C.b);
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
if (!lvl.PhysSpongeCheck(C.b)) {
byte block = lvl.blocks[C.b];
if (lvl.GetTile(x, (ushort)(y + 1), z) != Block.Zero) {
lvl.PhysSandCheck(lvl.PosToInt(x, (ushort)(y + 1), z));
}
lvl.PhysWater(lvl.PosToInt((ushort)(x + 1), y, z), block);
lvl.PhysWater(lvl.PosToInt((ushort)(x - 1), y, z), block);
lvl.PhysWater(lvl.PosToInt(x, y, (ushort)(z + 1)), block);
lvl.PhysWater(lvl.PosToInt(x, y, (ushort)(z - 1)), block);
lvl.PhysWater(lvl.PosToInt(x, (ushort)(y - 1), z), block);
} else { //was placed near sponge
lvl.AddUpdate(C.b, Block.air);
}
if (C.extraInfo.IndexOf("wait") == -1)
C.time = 255;
}