本文整理汇总了C#中MCForge.Player.manualChange方法的典型用法代码示例。如果您正苦于以下问题:C# Player.manualChange方法的具体用法?C# Player.manualChange怎么用?C# Player.manualChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Player
的用法示例。
在下文中一共展示了Player.manualChange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
Player.SendMessage(p, "Generating maze... this could take a while");
CatchPos first = (CatchPos)p.blockchangeObject;
int width = Math.Max(x, first.X) - Math.Min(x, first.X);
if (width % 2 != 0) { width++;x--; }
width -= 2;
int height = Math.Max(z, first.Z) - Math.Min(z, first.Z);
if (height % 2 != 0) { height++;z--; }
height -= 2;
//substract 2 cause we will just make the inner. the outer wall is made seperately
wall = new bool[width+1, height+1];//+1 cause we begin at 0 so we need one object more
for (int w = 0; w <= width; w++)
{
for (int h = 0; h <= height; h++)
{
wall[w, h] = true;
}
}
GridNode.maxX = width;
GridNode.maxY = height;
//Make a Stack
Stack s = new Stack(width * height);
//Random rand = new Random(DateTime.Now.Millisecond);//ha yeah randomized :P
//lets begin in the lower left corner eh?(0,0)
s.Push(new GridNode(0, 0));
wall[0, 0] = false;
while (true)
{
GridNode node = (GridNode)s.Peek();
if (node.turnsPossible())
{
GridNode[] nodearray = node.getRandomNext();
wall[nodearray[0].X, nodearray[0].Y] = false;
wall[nodearray[1].X, nodearray[1].Y] = false;
s.Push(nodearray[1]);
//we get the next two nodes
//the first is a middle node from which there shouldnt start a new corridor
//the second is added to the stack. next try will be with this node
//i hope this will work this time...
}
else
{
s.Pop();//if this node is a dead and it will be removed
}
if (s.Count < 1)
{
break;//if no nodes are free anymore we will end the generation here
}
}
Player.SendMessage(p, "Maze is generated. now painting...");
//seems to be there are no more moves possible
//paint that shit :P
ushort minx = Math.Min(x, first.X);
ushort minz = Math.Min(z, first.Z);
ushort maxx = Math.Max(x, first.X);
maxx++;
ushort maxz = Math.Max(z, first.Z);
maxz++;
for (ushort xx = 0; xx <= width; xx++)
{
for (ushort zz = 0; zz <= height; zz++)
{
if (wall[xx, zz])
{
p.level.Blockchange(p, (ushort)(xx + minx+1), y, (ushort)(zz + minz+1), Block.staircasefull);
p.level.Blockchange(p, (ushort)(xx + minx+1), (ushort)(y + 1), (ushort)(zz + minz+1), Block.leaf);
p.level.Blockchange(p, (ushort)(xx + minx+1), (ushort)(y + 2), (ushort)(zz + minz+1), Block.leaf);
}
}
}
p.ignorePermission = true;
Command.all.Find("cuboid").Use(p, "walls");
p.manualChange(minx, y, minz, 0, Block.staircasefull);
p.manualChange(maxx, y, maxz, 0, Block.staircasefull);
Command.all.Find("cuboid").Use(p, "walls");
p.manualChange(minx, (ushort)(y + 1), minz, 0, Block.leaf);
p.manualChange(maxx, (ushort)(y + 2), maxz, 0, Block.leaf);
Player.SendMessage(p, "Maze painted. Build your entrance and exit yourself");
randomizer = 0;
}
示例2: Use
public override void Use(Player p, string message)
{
if (p == null)
{
Player.SendMessage(p, "This command can only be used in-game");
return;
}
string[] parameters = message.Split(' ');
ushort[] click = p.lastClick;
if (message.IndexOf(' ') != -1)
{
if (parameters.Length != 3)
{
Help(p);
return;
}
else
{
for (int value = 0; value < 3; value++)
{
if (parameters[value].ToLower() == "x" || parameters[value].ToLower() == "y" || parameters[value].ToLower() == "z")
click[value] = p.lastClick[value];
else if (isValid(parameters[value], value, p))
click[value] = ushort.Parse(parameters[value]);
else
{
Player.SendMessage(p, "\"" + parameters[value] + "\" was not valid");
return;
}
}
}
}
p.lastCMD = "click";
p.manualChange(click[0], click[1], click[2], 0, Block.rock);
Player.SendMessage(p, "Clicked &b(" + click[0] + ", " + click[1] + ", " + click[2] + ")");
}