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


C# NPC.Spawn方法代码示例

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


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

示例1: SpawnWolf

	private void SpawnWolf(int regionId, Random rnd)
	{
		var pos = Center.GetRandomInRect(6000, 4000, rnd);

		// Spawn wolf on random position and respawn it if it dies.
		var npc = new NPC(20001); // Gray Wolf
		npc.Death += (killed, killer) =>
		{
			SpawnWolf(regionId, rnd);
		};
		npc.Spawn(regionId, pos.X, pos.Y);
	}
开发者ID:xKamuna,项目名称:aura,代码行数:12,代码来源:202003_save_my_sheep.cs

示例2: CreateRegionAndWarp

	public void CreateRegionAndWarp(Creature creature)
	{
		var region = new DynamicRegion(118);
		ChannelServer.Instance.World.AddRegion(region);

		var rnd = RandomProvider.Get();
		var sheepAmount = SheepAmount;

		// After x ms (success)
		var timer = SetTimeout(Time, () =>
		{
			// Unofficial, I think the msg also depends on how well you did.
			Send.Notice(creature, NoticeType.MiddleSystem, L("The time is over, you did it."));
			Send.RemoveQuestTimer(creature);
			creature.Keywords.Give("TirChonaill_Tutorial_Thinking");
			creature.Warp(1, 27622, 42125);
		});

		// Spawn sheep
		for (int i = 0; i < sheepAmount; ++i)
		{
			var pos = Center.GetRandomInRect(6000, 4000, rnd);

			var npc = new NPC(40001); // Sheep
			npc.Death += (killed, killer) =>
			{
				sheepAmount--;

				// Cancel if success is not possible anymore.
				if (sheepAmount < SheepMinAmount)
				{
					Send.Notice(creature, NoticeType.MiddleSystem, L("You've failed to save the sheep."));
					Send.RemoveQuestTimer(creature);
					StopTimer(timer);
					creature.Warp(1, 27622, 42125);
					return;
				}

				Send.UpdateQuestTimerCounter(creature, L("Remaining sheep: {0}"), sheepAmount);
			};
			npc.Spawn(region.Id, pos.X, pos.Y);
		}

		// Spawn wolves
		for (int i = 0; i < WolfAmount; ++i)
			SpawnWolf(region.Id, rnd);

		// Warp to region and start visible timer
		creature.Warp(region.Id, 60000, 58000);
		Send.SetQuestTimer(creature, Time, L("Protect the sheep from wolves"), L("Deadline: {0}"), L("Remaining sheep: {0}"), sheepAmount);
	}
开发者ID:xKamuna,项目名称:aura,代码行数:51,代码来源:202003_save_my_sheep.cs

示例3: SpawnMinion

	protected Creature SpawnMinion(int raceId, int xOffset, int yOffset)
	{
		var regionId = Spawn.Location.RegionId;
		var x = Spawn.Location.X + xOffset;
		var y = Spawn.Location.Y + yOffset;

		var npc = new NPC(raceId);
		npc.Death += this.OnMinionDied;

		npc.Spawn(regionId, x, y);
		Send.SpawnEffect(SpawnEffect.Monster, regionId, x, y, npc, npc);

		lock (_syncLock)
			_minions.Add(npc);

		return npc;
	}
开发者ID:aura-project,项目名称:aura,代码行数:17,代码来源:base.cs


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