Aura.Channel.World.Entities.Prop.IsInside C# (CSharp) Method

IsInside() public method

Returns true if the given position is inside the prop.
public IsInside ( int x, int y ) : bool
x int
y int
return bool
		public bool IsInside(int x, int y)
		{
			if (this.Shapes.Count == 0)
				return false;

			var result = false;
			var point = new Point(x, y);

			foreach (var points in this.Shapes)
			{
				for (int i = 0, j = points.Length - 1; i < points.Length; j = i++)
				{
					if (((points[i].Y > point.Y) != (points[j].Y > point.Y)) && (point.X < (points[j].X - points[i].X) * (point.Y - points[i].Y) / (points[j].Y - points[i].Y) + points[i].X))
						result = !result;
				}

				if (result)
					return true;
			}

			return false;
		}
	}