本文整理汇总了C#中MCDawn.Player.manualChange方法的典型用法代码示例。如果您正苦于以下问题:C# Player.manualChange方法的具体用法?C# Player.manualChange怎么用?C# Player.manualChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCDawn.Player
的用法示例。
在下文中一共展示了Player.manualChange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public override void Use(Player p, string message)
{
if (message.Trim() == "" && !p.autobuild) { Help(p); return; }
if (p == null) { Player.SendMessage(p, "Command not usable from Console."); return; }
if (message.Trim().ToLower() == "off" || (p.autobuild && message.Trim() == "")) { p.autobuild = false; Player.SendMessage(p, "AutoBuild turned off."); return; }
if (message.Split(' ').Length < 2 || message.Split(' ').Length > 3) { Help(p); return; }
byte action; string actionString = message.Split(' ')[0].ToLower().Trim();
if (actionString == "build" || actionString == "place" || actionString == "1") { action = 1; }
else if (actionString == "destroy" || actionString == "break" || actionString == "0") { action = 0; }
else { Player.SendMessage(p, "Please choose a valid block action."); return; }
byte block = Block.Byte(message.Split(' ')[1]);
if (block >= 255) { Player.SendMessage(p, "Unknown Block."); return; }
if (block == Block.air) { Player.SendMessage(p, "Cannot use air as block. Set action to \"destroy\" instead."); return; }
double interval = 1;
if (message.Split(' ').Length > 2)
{
try { interval = Math.Abs(double.Parse(message.Split(' ')[2])); }
catch { Player.SendMessage(p, "Please choose a valid interval."); return; }
}
p.autobuild = true; Player.SendMessage(p, "AutoBuild mode activated!");
Thread autoBuildThread = new Thread(new ThreadStart(delegate
{
try // Try/Catch block in case player is looking outside the map.
{
while (p.autobuild)
{
double x, y, z;
for (byte i = 0; i < 4; i++)
{
x = Math.Round((p.pos[0] / 32) + (double)(Math.Sin(((double)(128 - p.rot[0]) / 256) * 2 * Math.PI) * i * Math.Cos(((double)(p.rot[1]) / 256) * 2 * Math.PI)));
y = Math.Round((p.pos[1] / 32) + (double)(Math.Cos(((double)(p.rot[1] + 64) / 256) * 2 * Math.PI) * i));
z = Math.Round((p.pos[2] / 32) + (double)(Math.Cos(((double)(128 - p.rot[0]) / 256) * 2 * Math.PI) * i * Math.Cos(((double)(p.rot[1]) / 256) * 2 * Math.PI)));
if (p.level.GetTile((ushort)(x), (ushort)(y), (ushort)(z)) != Block.air || i >= 3) { p.manualChange((ushort)(x), (ushort)(y), (ushort)(z), action, block); break; }
}
Thread.Sleep((int)(1000 * interval));
}
}
catch { }
})); autoBuildThread.Start();
}
示例2: Use
public override void Use(Player p, string message)
{
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.manualChange(click[0], click[1], click[2], 0, Block.rock);
Player.SendMessage(p, "Clicked &b(" + click[0] + ", " + click[1] + ", " + click[2] + ")");
}