Exemple #1
0
        /// <summary>
        /// Determines whether a certain area collides with this entity (based on its <see cref="Collision{TCoordinates}"/> component).
        /// </summary>
        /// <param name="area">The area to check for collision in world space.</param>
        /// <returns><c>true</c> if the <paramref name="area"/> does collide with this entity, <c>false</c> otherwise.</returns>
        public bool CollisionTest(Quadrangle area)
        {
            // With no valid collision control all collision checks always fail
            if (TemplateData.Collision == null)
            {
                return(false);
            }

            // Convert position from world space to entity space and transmit rotation
            var shiftedArea = area.Offset(-Position);

            return(TemplateData.Collision.CollisionTest(shiftedArea, Rotation));
        }