当前位置: 首页>>代码示例>>C#>>正文


C# Level.PhysWater方法代码示例

本文整理汇总了C#中Level.PhysWater方法的典型用法代码示例。如果您正苦于以下问题:C# Level.PhysWater方法的具体用法?C# Level.PhysWater怎么用?C# Level.PhysWater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Level的用法示例。


在下文中一共展示了Level.PhysWater方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoGeyser

        public static void DoGeyser(Level lvl, Check C, Random rand) {
            C.time++;
            ushort x, y, z;
            lvl.IntToPos(C.b, out x, out y, out z);
            byte below = lvl.GetTile(x, (ushort)(y - 1), z);
            
            if (below == Block.air) {
                lvl.AddUpdate(lvl.PosToInt(x, (ushort)(y - 1), z), Block.geyser);
            } else if (below != Block.geyser) {
                byte block = lvl.blocks[C.b];
                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);
            }

            if (lvl.physics <= 1 || C.time <= 10) return;
            C.time = 0;
            bool flowUp = false;
            
            GeyserFlow(lvl, x - 1, y, z, ref flowUp);
            GeyserFlow(lvl, x + 1, y, z, ref flowUp);
            GeyserFlow(lvl, x, y - 1, z, ref flowUp);
            GeyserFlow(lvl, x, y, z - 1, ref flowUp);
            GeyserFlow(lvl, x, y, z + 1, ref flowUp);
            if (flowUp)
                GeyserFlow(lvl, x, y + 1, z, ref flowUp);
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:28,代码来源:ExtLiquidPhysics.cs

示例2: 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;
            }
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:62,代码来源:LiquidPhysics.cs

示例3: 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;
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:22,代码来源:LiquidPhysics.cs

示例4: DoWaterfall

 public static void DoWaterfall(Level lvl, Check C, Random rand) {
     ushort x, y, z;
     lvl.IntToPos(C.b, out x, out y, out z);
     byte below = lvl.GetTile(x, (ushort)(y - 1), z);
     
     switch (below)
     {
         case Block.air:
             lvl.AddUpdate(lvl.PosToInt(x, (ushort)(y - 1), z), Block.WaterDown);
             if (C.extraInfo.IndexOf("wait") == -1)
                 C.time = 255;
             break;
         case Block.air_flood_down:
         case Block.lavastill:
         case Block.waterstill:
         case Block.WaterDown:
             break;
         default:
             byte block = lvl.blocks[C.b];
             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);
             if (C.extraInfo.IndexOf("wait") == -1)
                 C.time = 255;
             break;
     }
 }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:28,代码来源:ExtLiquidPhysics.cs


注:本文中的Level.PhysWater方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。