本文整理汇总了C#中MCForge.Level.skipChange方法的典型用法代码示例。如果您正苦于以下问题:C# Level.skipChange方法的具体用法?C# Level.skipChange怎么用?C# Level.skipChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Level
的用法示例。
在下文中一共展示了Level.skipChange方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCactus
public void AddCactus(Level Lvl, ushort x, ushort y, ushort z, Random Rand, bool blockChange = false, bool overwrite = true)
{
byte height = (byte)Rand.Next(3, 6);
ushort yy;
for (yy = 0; yy <= height; yy++) {
if (overwrite || Lvl.GetTile(z, (ushort)(y + yy), z) == Block.air)
if (blockChange) Lvl.Blockchange(x, (ushort)(y + yy), z, Block.green);
else Lvl.skipChange(x, (ushort)(y + yy), z, Block.green);
}
int inX = 0, inZ = 0;
switch (Rand.Next(1, 3))
{
case 1: inX = -1; break;
case 2:
default: inZ = -1; break;
}
for (yy = height; yy <= Rand.Next(height + 2, height + 5); yy++)
{
if (overwrite || Lvl.GetTile((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ)) == Block.air)
if (blockChange) Lvl.Blockchange((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ), Block.green);
else Lvl.skipChange((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ), Block.green);
}
for (yy = height; yy <= Rand.Next(height + 2, height + 5); yy++)
{
if (overwrite || Lvl.GetTile((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ)) == Block.air)
if (blockChange) Lvl.Blockchange((ushort)(x - inX), (ushort)(y + yy), (ushort)(z - inZ), Block.green);
else Lvl.skipChange((ushort)(x - inX), (ushort)(y + yy), (ushort)(z - inZ), Block.green);
}
}
示例2: GenerateMap
public bool GenerateMap(Level Lvl, string type, int seed = 0, bool useSeed = false)
{
DateTime startTime = DateTime.Now;
Server.s.Log("Attempting map gen");
if (Inuse) { Server.s.Log("Generator in use"); return false; }
Random rand = useSeed ? new System.Random(seed) : new System.Random();
try
{
Inuse = true;
terrain = new float[Lvl.width * Lvl.height];
overlay = new float[Lvl.width * Lvl.height];
if (!type.Equals("ocean"))
{ overlay2 = new float[Lvl.width * Lvl.height]; }
//float dispAux, pd;
ushort WaterLevel = (ushort)(Lvl.depth / 2 + 2);
if (type.Equals("ocean"))
{
WaterLevel = (ushort)(Lvl.depth * 0.85f);
}
//Generate the level
GenerateFault(terrain, Lvl, type, rand);
//APPLY FILTER to terrain
FilterAverage(Lvl);
//CREATE OVERLAY
//GenerateFault(overlay, Lvl, "overlay", rand);
Server.s.Log("Creating overlay");
GeneratePerlinNoise(overlay, Lvl, "", rand);
if (!type.Equals("ocean") && type != "desert")
{
Server.s.Log("Planning trees");
GeneratePerlinNoise(overlay2, Lvl, "", rand);
}
Server.s.Log("Converting height map");
Server.s.Log("And applying overlays");
float RangeLow = 0.2f;
float RangeHigh = 0.8f;
float TreeDens = 0.35f;
short TreeDist = 3;
//changes the terrain range based on type, also tree threshold
switch (type)
{
case "island":
RangeLow = 0.4f;
RangeHigh = 0.75f;
break;
case "forest":
RangeLow = 0.45f;
RangeHigh = 0.8f;
TreeDens = 0.7f;
TreeDist = 2;
break;
case "mountains":
RangeLow = 0.3f;
RangeHigh = 0.9f;
TreeDist = 4;
break;
case "ocean":
RangeLow = 0.1f;
RangeHigh = 0.6f;
break;
case "desert":
RangeLow = 0.5f;
RangeHigh = 0.85f;
WaterLevel = 0;
TreeDist = 24;
break;
default:
break;
}
//loops though evey X/Z coordinate
for (int bb = 0; bb < terrain.Length; bb++)
{
ushort x = (ushort)(bb % Lvl.width);
ushort y = (ushort)(bb / Lvl.width);
ushort z;
if (type.Equals("island"))
{
z = Evaluate(Lvl, Range(terrain[bb], RangeLow - NegateEdge(x, y, Lvl), RangeHigh - NegateEdge(x, y, Lvl)));
}
else
{
z = Evaluate(Lvl, Range(terrain[bb], RangeLow, RangeHigh));
}
if (z > WaterLevel)
{
for (ushort zz = 0; z - zz >= 0; zz++)
{
if (type == "desert")
{
Lvl.skipChange(x, (ushort)(z - zz), y, Block.sand);
//.........这里部分代码省略.........
示例3: AddTree
//
public void AddTree(Level Lvl, ushort x, ushort y, ushort z, Random Rand, bool blockChange = false, bool overwrite = true, Player p = null)
{
byte height = (byte)Rand.Next(5, 8);
short top = (short)(height - Rand.Next(2, 4));
ushort xxx, yyy, zzz;
for (ushort yy = 0; yy < top + height - 1; yy++)
{
if (overwrite || Lvl.GetTile(x, (ushort)(y + yy), z) == Block.air || (y + yy == y && Lvl.GetTile(x, (ushort)(y + yy), z) == Block.shrub))
if (blockChange)
if (p == null) Lvl.Blockchange(x, (ushort)(y + yy), z, Block.trunk);
else Lvl.Blockchange(p, x, (ushort)(y + yy), z, Block.trunk);
else Lvl.skipChange(x, (ushort)(y + yy), z, Block.trunk);
}
for (short xx = (short)-top; xx <= top; ++xx)
{
for (short yy = (short)-top; yy <= top; ++yy)
{
for (short zz = (short)-top; zz <= top; ++zz)
{
short Dist = (short)(Math.Sqrt(xx * xx + yy * yy + zz * zz));
if (Dist < top + 1)
{
if (Rand.Next((int)(Dist)) < 2)
{
try
{
xxx = (ushort)(x + xx);
yyy = (ushort)(y + yy + height);
zzz = (ushort)(z + zz);
if ((xxx != x || zzz != z || yy >= top - 1) && (overwrite || Lvl.GetTile(xxx, yyy, zzz) == Block.air))
if (blockChange)
if (p == null) Lvl.Blockchange(xxx, yyy, zzz, Block.leaf);
else Lvl.Blockchange(p, xxx, yyy, zzz, Block.leaf);
else Lvl.skipChange(xxx, yyy, zzz, Block.leaf);
}
catch { }
}
}
}
}
}
}
示例4: AddNotchTree
public void AddNotchTree(Level Lvl, ushort x, ushort y, ushort z, Random Rand, bool blockChange = false, bool overwrite = true, Player p = null)
{
byte dist, tile;
byte height = (byte)Rand.Next(3, 7);
byte top = (byte)(height - 2);
short xx, yy, zz;
ushort xxx, yyy, zzz;
for (yy = 0; yy <= height; yy++)
{
yyy = (ushort)(y + yy);
tile = Lvl.GetTile(x, yyy, z);
if (overwrite || tile == Block.air || (yyy == y && tile == Block.shrub))
if (blockChange)
if (p == null) Lvl.Blockchange(x, yyy, z, Block.trunk);
else Lvl.Blockchange(p, x, yyy, z, Block.trunk);
else Lvl.skipChange(x, yyy, z, Block.trunk);
}
for (yy = top; yy <= height + 1; yy++)
{
dist = yy > height - 1 ? (byte)1 : (byte)2;
for (xx = (short)-dist; xx <= dist; xx++)
{
for (zz = (short)-dist; zz <= dist; zz++)
{
xxx = (ushort)(x + xx);
yyy = (ushort)(y + yy);
zzz = (ushort)(z + zz);
tile = Lvl.GetTile(xxx, yyy, zzz);
//Server.s.Log(String.Format("{0} {1} {2}", xxx, yyy, zzz));
if ((xxx == x && zzz == z && yy <= height) || (!overwrite && tile != Block.air))
continue;
if (Math.Abs(xx) == dist && Math.Abs(zz) == dist)
{
if (yy > height)
continue;
if (Rand.Next(2) == 0)
{
if (blockChange)
if (p == null) Lvl.Blockchange(xxx, yyy, zzz, Block.leaf);
else Lvl.Blockchange(p, xxx, yyy, zzz, Block.leaf);
else Lvl.skipChange(xxx, yyy, zzz, Block.leaf);
}
}
else
{
if (blockChange)
if (p == null) Lvl.Blockchange(xxx, yyy, zzz, Block.leaf);
else Lvl.Blockchange(p, xxx, yyy, zzz, Block.leaf);
else Lvl.skipChange(xxx, yyy, zzz, Block.leaf);
}
}
}
}
}
示例5: AddTree
//
void AddTree(Level Lvl, ushort x, ushort y, ushort z, Random Rand)
{
byte height = (byte)Rand.Next(5, 8);
for (ushort yy = 0; yy < height; yy++) Lvl.skipChange(x, (ushort)(y + yy), z, Block.trunk);
short top = (short)(height - Rand.Next(2, 4));
for (short xx = (short)-top; xx <= top; ++xx)
{
for (short yy = (short)-top; yy <= top; ++yy)
{
for (short zz = (short)-top; zz <= top; ++zz)
{
short Dist = (short)(Math.Sqrt(xx * xx + yy * yy + zz * zz));
if (Dist < top + 1)
{
if (Rand.Next((int)(Dist)) < 2)
{
try
{
Lvl.skipChange((ushort)(x + xx), (ushort)(y + yy + height), (ushort)(z + zz), Block.leaf);
}
catch { }
}
}
}
}
}
}
示例6: AddCactus
void AddCactus(Level Lvl, ushort x, ushort y, ushort z, Random Rand)
{
byte height = (byte)Rand.Next(3, 6);
ushort yy;
for (yy = 0; yy <= height; yy++) Lvl.skipChange(x, (ushort)(y + yy), z, Block.green);
int inX = 0, inZ = 0;
switch (Rand.Next(1, 3))
{
case 1: inX = -1; break;
case 2:
default: inZ = -1; break;
}
for (yy = height; yy <= Rand.Next(height + 2, height + 5); yy++) Lvl.skipChange((ushort)(x + inX), (ushort)(y + yy), (ushort)(z + inZ), Block.green);
for (yy = height; yy <= Rand.Next(height + 2, height + 5); yy++) Lvl.skipChange((ushort)(x - inX), (ushort)(y + yy), (ushort)(z - inZ), Block.green);
}
示例7: AddTree
//
public void AddTree(Level Lvl, ushort x, ushort y, ushort z, Random Rand, bool blockChange = false)
{
byte height = (byte)Rand.Next(5, 8);
short top = (short)(height - Rand.Next(2, 4));
ushort xxx, yyy, zzz;
for (ushort yy = 0; yy < top + height; yy++)
{
if (blockChange) Lvl.Blockchange(x, (ushort)(y + yy), z, Block.trunk);
else Lvl.skipChange(x, (ushort)(y + yy), z, Block.trunk);
}
for (short xx = (short)-top; xx <= top; ++xx)
{
for (short yy = (short)-top; yy <= top; ++yy)
{
for (short zz = (short)-top; zz <= top; ++zz)
{
short Dist = (short)(Math.Sqrt(xx * xx + yy * yy + zz * zz));
if (Dist < top + 1)
{
if (Rand.Next((int)(Dist)) < 2)
{
try
{
xxx = (ushort)(x + xx);
yyy = (ushort)(y + yy + height);
zzz = (ushort)(z + zz);
if (xxx != x || zzz != z || yy >= top)
{
if (blockChange) Lvl.Blockchange(xxx, yyy, zzz, Block.leaf);
else Lvl.skipChange(xxx, yyy, zzz, Block.leaf);
}
}
catch { }
}
}
}
}
}
}