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

SetPosition() public method

Sets position and destination.
public SetPosition ( int x, int y ) : Position
x int
y int
return Position
		public Position SetPosition(int x, int y)
		{
			return _position = _destination = new Position(x, y);
		}

Usage Example

Example #1
0
		public void Use(Creature creature, Skill skill, Packet packet)
		{
			var targetPos = new Position(packet.GetLong());

			// Check distance to target position
			if (!creature.GetPosition().InRange(targetPos, (int)skill.RankData.Var2 + DistanceBuffer))
			{
				Send.Notice(creature, Localization.Get("Out of range."));
				Send.SkillUse(creature, skill.Info.Id, 0);
				return;
			}

			// Stop creature's movement.
			creature.StopMove();

			// Teleport effect (does not actually teleport)
			Send.Effect(creature, Effect.SilentMoveTeleport, (byte)2, targetPos.X, targetPos.Y);

			// Teleport player to target position
			creature.SetPosition(targetPos.X, targetPos.Y);
			Send.SkillTeleport(creature, targetPos.X, targetPos.Y);

			Send.SkillUse(creature, skill.Info.Id, 1);
		}
All Usage Examples Of Aura.Channel.World.Entities.Creature::SetPosition