コード例 #1
0
        /// <summary>
        /// Is there a collision between the two elements ?
        /// </summary>
        /// <param name="e2"></param>
        /// <returns></returns>
        public virtual bool Collide(Hitbox h2)
        {
            if (h2.GetType() == typeof(CircleHitbox) || h2.GetType() == typeof(PositionedCircleHitbox) )
            {
                return Collide(((CircleHitbox)h2).Circle);
            }
            else if (h2.GetType() == typeof(SquareHitbox))
            {
                return Collide(((SquareHitbox)h2).Square);
            }

            return false;
        }
コード例 #2
0
        /// <summary>
        /// Is there a collision between the two elements ?
        /// </summary>
        /// <param name="e2"></param>
        /// <returns></returns>
        public virtual bool Collide(Hitbox h2)
        {
            if (h2.GetType() == typeof(CircleHitbox) || h2.GetType() == typeof(PositionedCircleHitbox))
            {
                return(Collide(((CircleHitbox)h2).Circle));
            }
            else if (h2.GetType() == typeof(SquareHitbox))
            {
                return(Collide(((SquareHitbox)h2).Square));
            }

            return(false);
        }