当前位置: 首页>>代码示例>>C#>>正文


C# WorldObject.setSecondForm方法代码示例

本文整理汇总了C#中WorldObject.setSecondForm方法的典型用法代码示例。如果您正苦于以下问题:C# WorldObject.setSecondForm方法的具体用法?C# WorldObject.setSecondForm怎么用?C# WorldObject.setSecondForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorldObject的用法示例。


在下文中一共展示了WorldObject.setSecondForm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: activateObelisk

	    private static void activateObelisk(int index) {
		    if (obeliskActivated[index])
			    return;

		    Location[] obeliskLocations = getLocations(index);
		    for (int i = 0; i < 4; i++) {
			    WorldObject obj = new WorldObject(OBELISK_ID[index], ACTIVATED_ID, obeliskLocations[i], 0, 10);
			    obj.setSecondForm(true);
			    Server.getGlobalObjects().add(obj);
			    foreach(Player p in Server.getPlayerList()) {
				    p.getPackets().createObject(ACTIVATED_ID, obeliskLocations[i], 0, 10);
			    }
		    }
		    obeliskActivated[index] = true;
            Event activateObeliskEvent = new Event(4000 + (misc.random(4)) * 1000);
            activateObeliskEvent.setAction(() => {
				activateObeliskEvent.stop();
				int randomOb = index;
				while(randomOb == index) {
					// While loop so if the random one is the same one, it picks a new one
					randomOb = misc.random(OBELISK_ID.Length);
				}
				int random = randomOb;
				foreach(Player p in Server.getPlayerList()) {
					if (p != null) {
						if (p.getLocation().inArea(OBELISK_LOCATIONS[index][0] - 2, OBELISK_LOCATIONS[index][1] - 2, OBELISK_LOCATIONS[index][0] + 2, OBELISK_LOCATIONS[index][1] + 2)) {
							// TODO get the big purple graphic
							p.setLastGraphics(new Graphics(1690));
							p.setLastAnimation(new Animation(8939));
							Player p2 = p;

                            Event obeliskTeleportEvent = new Event(1200);
                            obeliskTeleportEvent.setAction(() => {
								obeliskTeleportEvent.stop();
								p2.teleport(new Location((OBELISK_LOCATIONS[random][0] - 1) + misc.random(2), (OBELISK_LOCATIONS[random][1] - 1) + misc.random(2), 0));
								
                                Event obeliskAnimationEvent = new Event(500);
                                obeliskAnimationEvent.setAction(() => {
                                    obeliskAnimationEvent.stop();
									p2.setLastAnimation(new Animation(8941));
								});
                                Server.registerEvent(obeliskAnimationEvent);
							});
                            Server.registerEvent(obeliskTeleportEvent);
						}
					}
				}

				for (int i = 0; i < 4; i++) {
					WorldObject obj = Server.getGlobalObjects().getObject(OBELISK_ID[index], obeliskLocations[i]);
					Server.getGlobalObjects().restoreObject(obj);
				}
				obeliskActivated[index] = false;
		    });
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:55,代码来源:WildernessObelisks.cs


注:本文中的WorldObject.setSecondForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。