本文整理汇总了C#中Level.PhysSpongeCheck方法的典型用法代码示例。如果您正苦于以下问题:C# Level.PhysSpongeCheck方法的具体用法?C# Level.PhysSpongeCheck怎么用?C# Level.PhysSpongeCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level.PhysSpongeCheck方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: LavaBlocked
static bool LavaBlocked(Level lvl, ushort x, ushort y, ushort z) {
int b = lvl.PosToInt(x, y, z);
if (b == -1)
return true;
if (Server.lava.active && Server.lava.map == lvl && Server.lava.InSafeZone(x, y, z))
return true;
if (lvl.physics > 1 && lvl.blocks[b] >= Block.red && lvl.blocks[b] <= Block.white
&& !lvl.PhysSpongeCheck(b, true))
return false; // Adv physics destroys cloth
switch (lvl.blocks[b]) {
case Block.air:
return false;
case Block.water:
case Block.activedeathwater:
if (!lvl.PhysSpongeCheck(b, true)) return false;
break;
case Block.sand:
case Block.gravel:
return false;
case Block.wood:
case Block.shrub:
case Block.trunk:
case Block.leaf:
case Block.yellowflower:
case Block.redflower:
case Block.mushroom:
case Block.redmushroom:
if (lvl.physics > 1 && !lvl.PhysSpongeCheck(b, true)) return false;
break;
}
return true;
}
示例3: DoLavaUniformFlow
static void DoLavaUniformFlow(Level lvl, Check C, Random rand, bool checkWait) {
lvl.liquids.Remove(C.b);
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
if (!lvl.PhysSpongeCheck(C.b, true)) {
byte block = lvl.blocks[C.b];
lvl.PhysLava(lvl.PosToInt((ushort)(x + 1), y, z), block);
lvl.PhysLava(lvl.PosToInt((ushort)(x - 1), y, z), block);
lvl.PhysLava(lvl.PosToInt(x, y, (ushort)(z + 1)), block);
lvl.PhysLava(lvl.PosToInt(x, y, (ushort)(z - 1)), block);
lvl.PhysLava(lvl.PosToInt(x, (ushort)(y - 1), z), block);
} else { //was placed near sponge
lvl.AddUpdate(C.b, Block.air);
}
if (!checkWait || C.extraInfo.IndexOf("wait") == -1)
C.time = 255;
}
示例4: DoLavaRandowFlow
static void DoLavaRandowFlow(Level lvl, Check C, Random rand, bool checkWait) {
bool[] blocked = null;
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
if (!lvl.PhysSpongeCheck(C.b, true)) {
C.time = (byte)rand.Next(3);
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 (!blocked[0] && rand.Next(4) == 0) {
lvl.PhysLava(lvl.PosToInt((ushort)(x + 1), y, z), block);
blocked[0] = true;
}
if (!blocked[1] && rand.Next(4) == 0) {
lvl.PhysLava(lvl.PosToInt((ushort)(x - 1), y, z), block);
blocked[1] = true;
}
if (!blocked[2] && rand.Next(4) == 0) {
lvl.PhysLava(lvl.PosToInt(x, y, (ushort)(z + 1)), block);
blocked[2] = true;
}
if (!blocked[3] && rand.Next(4) == 0) {
lvl.PhysLava(lvl.PosToInt(x, y, (ushort)(z - 1)), block);
blocked[3] = true;
}
if (!blocked[4] && rand.Next(4) == 0) {
lvl.PhysLava(lvl.PosToInt(x, (ushort)(y - 1), z), block);
blocked[4] = true;
}
if (!blocked[0] && LavaBlocked(lvl, (ushort)(x + 1), y, z))
blocked[0] = true;
if (!blocked[1] && LavaBlocked(lvl, (ushort)(x - 1), y, z))
blocked[1] = true;
if (!blocked[2] && LavaBlocked(lvl, x, y, (ushort)(z + 1)))
blocked[2] = true;
if (!blocked[3] && LavaBlocked(lvl, x, y, (ushort)(z - 1)))
blocked[3] = true;
if (!blocked[4] && LavaBlocked(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 (!checkWait || C.extraInfo.IndexOf("wait") == -1)
C.time = 255;
}
if (blocked != null && (!checkWait || C.extraInfo.IndexOf("wait") == -1))
if (blocked[0] && blocked[1] && blocked[2] && blocked[3] && blocked[4])
{
lvl.liquids.Remove(C.b);
C.time = 255;
}
}
示例5: WaterBlocked
static bool WaterBlocked(Level lvl, ushort x, ushort y, ushort z) {
int b = lvl.PosToInt(x, y, z);
if (b == -1)
return true;
if (Server.lava.active && Server.lava.map == lvl && Server.lava.InSafeZone(x, y, z))
return true;
switch (lvl.blocks[b]) {
case Block.air:
case Block.lava:
case Block.lava_fast:
case Block.activedeathlava:
if (!lvl.PhysSpongeCheck(b)) return false;
break;
case Block.shrub:
case Block.yellowflower:
case Block.redflower:
case Block.mushroom:
case Block.redmushroom:
if (lvl.physics > 1 && !lvl.PhysSpongeCheck(b)) return false;
break;
case Block.sand:
case Block.gravel:
case Block.wood_float:
return false;
}
return true;
}
示例6: 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;
}