Aura.Channel.World.Entities.Creature.SetLocationNear C# (CSharp) Method

SetLocationNear() public method

Sets region, x, and y, to be near entity. Also randomizes direction.
public SetLocationNear ( Entity entity, int range ) : void
entity Entity
range int
return void
		public void SetLocationNear(Entity entity, int range)
		{
			var rnd = RandomProvider.Get();
			var pos = entity.GetPosition();
			var target = pos.GetRandomInRange(range, rnd);
			var dir = (byte)rnd.Next(256);

			this.SetLocation(entity.RegionId, target.X, target.Y);
			this.Direction = dir;
		}