示例#1
0
		public OnGraph(Server.Game.Api gsApi)
			: base(gsApi)
		{
			gsApi.FinishMoving += (Model.Creature creature) =>
			{
				if (gsApi.World.Me == creature)
				{
					var current = Target;
					if (current.Nigh.Count > 1)
					{
						var variants = new List<Model.Graph.Node>();
						foreach(var node in current.Nigh)
							if(!node.Equals(Previous))
								variants.Add(node);
						var index = Random.Next(variants.Count);
						foreach (var node in variants)
							if (index-- == 0)
							{
								Target = node;
								break;
							}
					}
					else
						Target = current.Nigh.First();
					Previous = current;

					gsApi.MoveTo(Target.Point);
				}
			};
		}