Terraria.Projectile.Colliding C# (CSharp) Method

Colliding() public method

public Colliding ( Rectangle myRect, Rectangle targetRect ) : bool
myRect Microsoft.Xna.Framework.Rectangle
targetRect Microsoft.Xna.Framework.Rectangle
return bool
        public bool Colliding(Rectangle myRect, Rectangle targetRect)
        {
            if (type == 598 && targetRect.Width > 8 && targetRect.Height > 8)
                targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
            else if (type == 614 && targetRect.Width > 8 && targetRect.Height > 8)
                targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
            else if (type == 636 && targetRect.Width > 8 && targetRect.Height > 8)
                targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
            else if (type == 607)
            {
                myRect.X += (int)velocity.X;
                myRect.Y += (int)velocity.Y;
            }
            if (myRect.Intersects(targetRect))
                return true;
            if (type == 461)
            {
                float collisionPoint = 0.0f;
                if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetRect), Utils.Size(targetRect), Center, Center + velocity * localAI[1], 22f * scale, ref collisionPoint))
                    return true;
            }
            else if (type == 642)
            {
                float collisionPoint = 0.0f;
                if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetRect), Utils.Size(targetRect), Center, Center + velocity * localAI[1], 30f * scale, ref collisionPoint))
                    return true;
            }
            else if (type == 632)
            {
                float collisionPoint = 0.0f;
                if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetRect), Utils.Size(targetRect), Center, Center + velocity * localAI[1], 22f * scale, ref collisionPoint))
                    return true;
            }
            else if (type == 455)
            {
                float collisionPoint = 0.0f;
                if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetRect), Utils.Size(targetRect), Center, Center + velocity * localAI[1], 36f * scale, ref collisionPoint))
                    return true;
            }
            else if (type == 611)
            {
                float collisionPoint = 0.0f;
                if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetRect), Utils.Size(targetRect), Center, Center + velocity, 16f * scale, ref collisionPoint))
                    return true;
            }
            else if (type == 537)
            {
                float collisionPoint = 0.0f;
                if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetRect), Utils.Size(targetRect), Center, Center + velocity * localAI[1], 22f * scale, ref collisionPoint))
                    return true;
            }
            else if (type == 466 || type == 580)
            {
                for (int index = 0; index < oldPos.Length; ++index)
                {
                    myRect.X = (int)oldPos[index].X;
                    myRect.Y = (int)oldPos[index].Y;
                    if (myRect.Intersects(targetRect))
                        return true;
                }
            }
            else if (type == 464 && ai[1] != 1.0)
            {
                Vector2 spinningpoint = Utils.RotatedBy(new Vector2(0.0f, -720f), Utils.ToRotation(velocity), new Vector2()) * (float)(ai[0] % 45.0 / 45.0);
                for (int index = 0; index < 6; ++index)
                {
                    float num = (float)(index * 6.28318548202515 / 6.0);
                    if (Utils.CenteredRectangle(Center + Utils.RotatedBy(spinningpoint, num, new Vector2()), new Vector2(30f, 30f)).Intersects(targetRect))
                        return true;
                }
            }
            return false;
        }