本文整理汇总了C#中MCForge.Level类的典型用法代码示例。如果您正苦于以下问题:C# Level类的具体用法?C# Level怎么用?C# Level使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Level类属于MCForge命名空间,在下文中一共展示了Level类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: placeBlock
public static void placeBlock(Level l, Player p, ushort x, ushort y, ushort z, ushort type)
{
if (p == null)
l.Blockchange(x, y, z, type);
else
l.Blockchange(p, x, y, z, type);
}
示例2: 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);
}
}
示例3: Register
/// <summary>
/// Register this event
/// </summary>
/// <param name="method">This is the delegate that will get called when this event occurs</param>
/// <param name="priority">The priority (imporantce) of this call</param>
/// <param name="plugin">The plugin object that is registering the event</param>
public static void Register(Level.OnLevelUnload method, Priority priority, Plugin plugin)
{
if (Find(plugin) != null)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnLevelUnloadEvent(method, priority, plugin));
Organize();
}
示例4: Register
/// <summary>
/// Register this event
/// </summary>
/// <param name="method">This is the delegate that will get called when this event occurs</param>
/// <param name="priority">The priority (imporantce) of this call</param>
/// <param name="plugin">The plugin object that is registering the event</param>
/// <param name="bypass">Register more than one of the same event</param>
public static void Register(Level.OnLevelLoaded method, Priority priority, Plugin plugin, bool bypass = false)
{
if (Find(plugin) != null)
if (!bypass)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnLevelLoadedEvent(method, priority, plugin));
Organize();
}
示例5: CancelLevelEvent
/// <summary>
/// Cancel Level event
/// </summary>
/// <param name="e">The event to cancel</param>
/// <param name="l">The level to cancel the event on</param>
public static void CancelLevelEvent(LevelEvents e, Level l)
{
switch (e)
{
case LevelEvents.LevelUnload:
break;
}
}
示例6: Find
public static Level Find(string levelName)
{
net.mcforge.world.Level temp = MCForge.Gui.Program.console.getServer().getLevelHandler().findLevel(levelName);
if (temp == null)
return null;
Level l = new Level(temp);
return l;
}
示例7: FoundCheck
public string FoundCheck(Level level, bool check)
{
if (gettinginfo == false)
{
Level.SaveSettings(level);
}
if (check) return "&aON";
else return "&cOFF";
}
示例8: Call
public static void Call(ushort x, ushort y, ushort z, byte time, string extra, Level l)
{
events.ForEach(delegate(OnPhysicsUpdateEvent p1)
{
try
{
p1.method(x, y, z, time, extra, l);
}
catch (Exception e) { Server.s.Log("The plugin " + p1.plugin.name + " errored when calling the LevelUnload Event!"); Server.ErrorLog(e); }
});
}
示例9: Call
public static void Call(Level l)
{
events.ForEach(delegate(OnLevelLoadedEvent p1)
{
try
{
p1.method(l);
}
catch (Exception e) { Server.s.Log("The plugin " + p1.plugin.name + " errored when calling the LevelUnload Event!"); Server.ErrorLog(e); }
});
}
示例10: CancelLevelEvent
/// <summary>
/// Cancel Level event
/// </summary>
/// <param name="e">The event to cancel</param>
/// <param name="l">The level to cancel the event on</param>
public static void CancelLevelEvent(LevelEvents e, Level l)
{
switch (e)
{
case LevelEvents.LevelUnload:
l.cancelunload = true;
break;
case LevelEvents.LevelSave:
l.cancelsave1 = true;
break;
}
}
示例11: Start
public void Start()
{
StartTimer = new System.Timers.Timer(1000);
ZombieLevel = Level.Find("main");
int loop = 6;
StartTimer.Start(); StartTimer.Elapsed += delegate
{
Server.s.Log(loop + "");
if (loop != 0)
{
int amountOfPlayers = PlayerCount();
Player.players.ForEach(delegate(Player p)
{
if (p.referee)
amountOfPlayers--;
});
//if (amountOfPlayers >= 2)
//{
MoreThanTwoPlayers = true;
loop--;
Player.GlobalMessage(c.gray + " - " + Server.DefaultColor + "Zombie Survival starts in " + loop + " seconds on level " +
ZombieLevel.name + c.gray + " - ");
/*}
else
{
if (MoreThanTwoPlayers)
Player.GlobalMessage(c.gray + " - " + Server.DefaultColor + "Zombie Survival requires more than 2 non-referee players online to play" + c.gray + " - ");
MoreThanTwoPlayers = false;
}*/
}
else
{
loop = 6;
Server.ZombieRound = true;
int randomMinutes = Random.Next(1, 4);
Player.GlobalMessage(c.gray + " - " + "Zombie Survival has started on level " + ZombieLevel.name + " for " + randomMinutes + " minutes! Type /g " + ZombieLevel.name + " to join! " + c.gray + " - ");
EndRoundTimer = new System.Timers.Timer((60000 * randomMinutes) - 30000);
EndRoundTimer.Start();
EndRoundTimer.Elapsed += delegate { EndRound(); };
StartTimer.Stop();
StartTimer.Dispose();
}
};
}
示例12: NegateEdge
//Forces the edge of a map to slope lower for island map types
float NegateEdge(ushort x, ushort y, Level Lvl)
{
float tempx = 0.0f, tempy = 0.0f;
float temp;
if (x != 0) { tempx = ((float)x / (float)Lvl.width) * 0.5f; }
if (y != 0) { tempy = ((float)y / (float)Lvl.height) * 0.5f; }
tempx = Math.Abs(tempx - 0.25f);
tempy = Math.Abs(tempy - 0.25f);
if (tempx > tempy)
{
temp = tempx - 0.15f;
}
else
{
temp = tempy - 0.15f;
}
//s.Log("temp = " + temp.ToString());
if (temp > 0.0f) { return temp; }
return 0.0f;
}
示例13: OnLevelLoadedEvent
internal OnLevelLoadedEvent(Level.OnLevelLoaded method, Priority priority, Plugin plugin)
{
this.plugin = plugin; this.priority = priority; this.method = method;
}
示例14: addLevel
public static void addLevel(Level level)
{
levels.Add(level);
}
示例15: GlobalBlockchange
public static void GlobalBlockchange(Level level, ushort x, ushort y, ushort z, byte type)
{
players.ForEach(delegate(Player p) { if (p.level == level) { p.SendBlockchange(x, y, z, type); } });
}