/// <summary>
        /// Creates a hitbox from a Floatrect.
        /// </summary>
        /// <param name="rect">AABB.</param>
        /// <returns>Hitbox.</returns>
        static public RectangleHitbox CreateHitbox(FloatRect rect)
        {
            RectangleHitbox result = new RectangleHitbox();

            result.Position   = rect.TopLeft() + rect.Size() / 2;
            result.HalfExtend = rect.Size() / 2;
            return(result);
        }
Beispiel #2
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="copy"></param>
 public RectangleHitbox(RectangleHitbox copy) : this()
 {
     HalfExtend = new Vector2f();
     Position   = copy.Position;
     Origin     = copy.Origin;
     Scale      = copy.Scale;
     Rotation   = copy.Rotation;
 }