本文整理汇总了C#中Level.Blockchange方法的典型用法代码示例。如果您正苦于以下问题:C# Level.Blockchange方法的具体用法?C# Level.Blockchange怎么用?C# Level.Blockchange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level.Blockchange方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCactus
public static void AddCactus(Level l, ushort x, ushort y, ushort z, byte type)
{
ushort num2;
byte num = (byte)random.Next(3, 6);
for (num2 = 0; num2 <= num; num2 = (ushort)(num2 + 1))
{
l.Blockchange(x, (ushort)(y + num2), z, 0x19);
}
int num3 = 0;
int num4 = 0;
switch (random.Next(1, 3))
{
case 1:
num3 = -1;
break;
default:
num4 = -1;
break;
}
num2 = num;
while (num2 <= random.Next(num + 2, num + 5))
{
ushort x2 = (ushort)(x + num3); //width
ushort y2 = (ushort)(y + num2); //depth
ushort z2 = (ushort)(z + num4); //height
if (l.GetTile(x2, y2, z2) == 0)
{
l.Blockchange((ushort)(x + num3), (ushort)(y + num2), (ushort)(z + num4), 0x19);
}
num2 = (ushort)(num2 + 1);
}
for (num2 = num; num2 <= random.Next(num + 2, num + 5); num2 = (ushort)(num2 + 1))
{
ushort x2 = (ushort)(x - num3); //width
ushort y2 = (ushort)(y + num2); //depth
ushort z2 = (ushort)(z - num4); //height
if (l.GetTile(x2, y2, z2) == 0)
{
l.Blockchange((ushort)(x - num3), (ushort)(y + num2), (ushort)(z - num4), 0x19);
}
}
}
示例2: 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);
}
}
}
示例3: ShowWarningFuse
static void ShowWarningFuse(Level lvl, ushort x, ushort y, ushort z) {
lvl.Blockchange(x, (ushort)(y + 1), z, lvl.GetTile(x, (ushort)(y + 1), z) == Block.lavastill ? Block.air : Block.lavastill);
lvl.Blockchange(x, (ushort)(y - 1), z, lvl.GetTile(x, (ushort)(y - 1), z) == Block.lavastill ? Block.air : Block.lavastill);
lvl.Blockchange((ushort)(x + 1), y, z, lvl.GetTile((ushort)(x + 1), y, z) == Block.lavastill ? Block.air : Block.lavastill);
lvl.Blockchange((ushort)(x - 1), y, z, lvl.GetTile((ushort)(x - 1), y, z) == Block.lavastill ? Block.air : Block.lavastill);
lvl.Blockchange(x, y, (ushort)(z + 1), lvl.GetTile(x, y, (ushort)(z + 1)) == Block.lavastill ? Block.air : Block.lavastill);
lvl.Blockchange(x, y, (ushort)(z - 1), lvl.GetTile(x, y, (ushort)(z - 1)) == Block.lavastill ? Block.air : Block.lavastill);
}
示例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);
}
}
示例5: applyBlockToMap
public void applyBlockToMap(Player p, Level l)
{
l.Blockchange(p, X, Y, Z, Type);
//p.SendBlockchange(X, Y, Z, Type);
}
示例6: NukeS
public static void NukeS(Level l, ushort x, ushort y, ushort z, int size)
{
foreach (Player p in Player.players) if (p.level == l) p.SendBlockchange(x, y, z, 0);
List<string> toair = new List<string>();
int num3 = size;
for (short j = Convert.ToInt16(-num3); j <= num3; j = (short)(j + 1))
{
if ((x + j) < 0 || (x + j) > l.width) continue;
for (short k = Convert.ToInt16(-num3); k <= num3; k = (short)(k + 1))
{
if ((y + k) < 0 || (y + k) > l.depth) continue;
for (short m = Convert.ToInt16(-num3); m <= num3; m = (short)(m + 1))
{
if ((z + m) < 0 || (z + m) > l.length) continue;
short maxValue = (short)Math.Sqrt((double)(((j * j) + (k * k)) + (m * m))); //W00t FOUND THE SECRET!
if ((maxValue < (num3 + 1)) && (random.Next(maxValue) < size))
{
try
{
ushort x2 = (ushort)(x + j); //width
ushort y2 = (ushort)(y + k); //depth
ushort z2 = (ushort)(z + m); //height
if (x2 <= l.width && y2 <= l.depth && z2 <= l.length)
{
byte that = l.GetTile((ushort)(x + j), (ushort)((y + k)), (ushort)(z + m));
if (that != 7)
{
l.Blockchange((ushort)(x + j), (ushort)((y + k)), (ushort)(z + m), 0);
}
}
}
catch (Exception e)
{
Server.s.Log(e.Message);
}
}
}
}
}
}
示例7: PhysDoor
static void PhysDoor(Level lvl, ushort x, ushort y, ushort z, bool instaUpdate) {
int index = lvl.PosToInt(x, y, z);
if (index < 0) return;
byte rawBlock = lvl.blocks[index];
byte airDoor = Block.DoorAirs(rawBlock);
if (airDoor != 0) {
if (!instaUpdate)
lvl.AddUpdate(index, airDoor);
else
lvl.Blockchange(x, y, z, airDoor);
return;
}
if (Block.tDoor(rawBlock))
lvl.AddUpdate(index, Block.air, false, "wait 16 door 1 revert " + rawBlock.ToString());
byte oDoor = Block.odoor(rawBlock);
if (oDoor != Block.Zero)
lvl.AddUpdate(index, oDoor, true);
}
示例8: 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);
}