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


C# Level.MakeExplosion方法代码示例

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


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

示例1: Do

        public static void Do(Level lvl, Check C, Random rand) {
            int dirX = rand.Next(1, 10) <= 5 ? 1 : -1;
            int dirY = rand.Next(1, 10) <= 5 ? 1 : -1;
            int dirZ = rand.Next(1, 10) <= 5 ? 1 : -1;
            ushort x, y, z;
            lvl.IntToPos(C.b, out x, out y, out z);

            for (int cx = -dirX; cx != 2 * dirX; cx += dirX)
                for (int cy = -dirY; cy != 2 * dirY; cy += dirY)
                    for (int cz = -dirZ; cz != 2 * dirZ; cz += dirZ)
            {                
                byte rocketTail = lvl.GetTile((ushort)(x + cx), (ushort)(y + cy), (ushort)(z + cz));
                if (rocketTail != Block.fire) continue;
                
                int headIndex = lvl.PosToInt((ushort)(x - cx), (ushort)(y - cy), (ushort)(z - cz));
                byte rocketHead = headIndex < 0 ? Block.Zero : lvl.blocks[headIndex];                
                bool unblocked = !lvl.ListUpdate.Exists(u => u.b == headIndex || u.b == C.b);
                
                if (unblocked && (rocketHead == Block.air || rocketHead == Block.rocketstart)) {
                    lvl.AddUpdate(headIndex, Block.rockethead);
                    lvl.AddUpdate(C.b, Block.fire);
                } else if (rocketHead == Block.fire) {
                } else {
                    if (lvl.physics > 2)
                        lvl.MakeExplosion(x, y, z, 2);
                    else
                        lvl.AddUpdate(C.b, Block.fire);
                }
            }
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:30,代码来源:RocketPhysics.cs

示例2: ExpandAvanced

		static void ExpandAvanced(Level lvl, int x, int y, int z) {
			int index = lvl.PosToInt((ushort)x, (ushort)y, (ushort)z);
			if (index < 0) return;
			byte block = lvl.blocks[index];
			
			if (Block.FireKill(block))
				lvl.AddUpdate(index, Block.fire);
			else if (block == Block.tnt)
				lvl.MakeExplosion((ushort)x, (ushort)y, (ushort)z, -1);
		}
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:10,代码来源:FirePhysics.cs

示例3: DoSmallTnt

        public static void DoSmallTnt(Level lvl, Check C, Random rand) {
            ushort x, y, z;
            lvl.IntToPos(C.b, out x, out y, out z);

            if (C.p != null && C.p.PlayingTntWars) {
                int power = 2, threshold = 3;
                switch (TntWarsGame.GetTntWarsGame(C.p).GameDifficulty) {
                    case TntWarsGame.TntWarsDifficulty.Easy:
                        threshold = 7;
                        break;
                    case TntWarsGame.TntWarsDifficulty.Normal:
                        threshold = 5;
                        break;
                    case TntWarsGame.TntWarsDifficulty.Extreme:
                        power = 3;
                        break;
                }
                
                if (C.time < threshold) {
                    C.time++;
                    lvl.Blockchange(x, (ushort)(y + 1), z, lvl.GetTile(x, (ushort)(y + 1), z) == Block.lavastill
                                    ? Block.air : Block.lavastill);
                    return;
                }
                if (C.p.TntWarsKillStreak >= TntWarsGame.Properties.DefaultStreakTwoAmount 
                    && TntWarsGame.GetTntWarsGame(C.p).Streaks) {
                    power++;
                }
                lvl.MakeExplosion(x, y, z, power - 2, true, TntWarsGame.GetTntWarsGame(C.p));
                
                List<Player> Killed = new List<Player>();
                Player.players.ForEach(
                    delegate(Player p1)
                    {
                        if (p1.level == lvl && p1.PlayingTntWars && p1 != C.p
                            && Math.Abs((int)(p1.pos[0] / 32) - x) + Math.Abs((int)(p1.pos[1] / 32) - y) + Math.Abs((int)(p1.pos[2] / 32) - z) < ((power * 3) + 1)) {
                            Killed.Add(p1);
                        }
                    });
                TntWarsGame.GetTntWarsGame(C.p).HandleKill(C.p, Killed);
            } else {
                if (lvl.physics < 3) {
                    lvl.Blockchange(x, y, z, Block.air);
                } else {
                    if (C.time < 5 && lvl.physics == 3) {
                        C.time++;
                        lvl.Blockchange(x, (ushort)(y + 1), z, lvl.GetTile(x, (ushort)(y + 1), z) == Block.lavastill
                                        ? Block.air : Block.lavastill);
                        return;
                    }
                    lvl.MakeExplosion(x, y, z, 0);
                }
            }
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:54,代码来源:TntPhysics.cs

示例4: DoLargeTnt

 public static void DoLargeTnt(Level lvl, Check C, Random rand, int power) {
     ushort x, y, z;
     lvl.IntToPos(C.b, out x, out y, out z);
     
     if (lvl.physics < 3) {
         lvl.Blockchange(x, y, z, Block.air);
     } else {
         if (C.time < 5 && lvl.physics == 3) {
             C.time++;
             ShowWarningFuse(lvl, x, y, z);
             return;
         }
         lvl.MakeExplosion(x, y, z, power);
     }
 }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:15,代码来源:TntPhysics.cs

示例5: AnyDoor

 static void AnyDoor(Level lvl, Check C, ushort x, ushort y, ushort z, int timer, bool instaUpdate = false) {
     if (C.time != 0) {
         CheckDoorRevert(lvl, C, timer);
         return;
     }
     PhysDoor(lvl, (ushort)(x + 1), y, z, instaUpdate);
     PhysDoor(lvl, (ushort)(x - 1), y, z, instaUpdate);
     PhysDoor(lvl, x, y, (ushort)(z + 1), instaUpdate);
     PhysDoor(lvl, x, y, (ushort)(z - 1), instaUpdate);
     PhysDoor(lvl, x, (ushort)(y - 1), z, instaUpdate);
     PhysDoor(lvl, x, (ushort)(y + 1), z, instaUpdate);
     
     if (lvl.blocks[C.b] != Block.door8_air) {
         CheckDoorRevert(lvl, C, timer);
         return;
     }
     
     for (int xx = -1; xx <= 1; xx++)
         for (int yy = -1; yy <= 1; yy++)
             for (int zz = -1; zz <= 1; zz++)
     {
         byte b = lvl.GetTile(lvl.IntOffset(C.b, xx, yy, zz));
         if (b == Block.rocketstart) {
             if (lvl.physics == 5) {
                 lvl.Blockchange(x, y, z, Block.air);
                 return;
             }
             int b1 = lvl.IntOffset(C.b, xx * 3, yy * 3, zz * 3);
             int b2 = lvl.IntOffset(C.b, xx * 2, yy * 2, zz * 2);
             bool unblocked = lvl.GetTile(b1) == Block.air && lvl.GetTile(b2) == Block.air &&
                 !lvl.ListUpdate.Exists(u => u.b == b1) &&
                 !lvl.ListUpdate.Exists(u => u.b == b2);
             
             if (unblocked) {
                 lvl.AddUpdate(b1, Block.rockethead);
                 lvl.AddUpdate(b2, Block.fire);
             }
         } else if (b == Block.firework) {
             if (lvl.physics == 5) {
                 lvl.Blockchange(x, y, z, Block.air);
                 return;
             }
             int b1 = lvl.IntOffset(C.b, xx, yy + 1, zz);
             int b2 = lvl.IntOffset(C.b, xx, yy + 2, zz);
             bool unblocked = lvl.GetTile(b1) == Block.air && lvl.GetTile(b2) == Block.air &&
                 !lvl.ListUpdate.Exists(u => u.b == b1) &&
                 !lvl.ListUpdate.Exists(u => u.b == b2);
             
             if (unblocked) {
                 lvl.AddUpdate(b2, Block.firework);
                 lvl.AddUpdate(b1, Block.lavastill, false, "dissipate 100");
             }
         } else if (b == Block.tnt) {
             if (lvl.physics == 5) {
                 lvl.Blockchange(x, y, z, Block.air);
                 return;
             }
             lvl.MakeExplosion((ushort)(x + xx), (ushort)(y + yy), (ushort)(z + zz), 0);
         }
     }
     CheckDoorRevert(lvl, C, timer);
 }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:62,代码来源:DoorPhysics.cs


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