예제 #1
0
        public float DrawMoonlordHand(SpriteBatch spriteBatch, Vector2 drawHere, Vector2 drawThere)
        {
            SpriteEffects spriteEffects = SpriteEffects.None;

            float returnfangle = 0;

            float     angleoffset = MathHelper.PiOver2;
            Texture2D armTex      = Main.extraTexture[14];
            Texture2D armTex2     = Main.extraTexture[15];

            float   scale      = 1;
            float   armLength  = armSizes[0] - armOrigins[0];
            float   armLength2 = armSizes[1] - armOrigins[1];
            Vector2 dist       = drawThere - drawHere;
            Vector2 normal     = Vector2.Normalize(dist);
            Vector2 hand2loc   = drawHere + normal * Math.Min(dist.Length(), ((armLength + armLength2)) - 1);

            Vector2 CirclePoint1, CirclePoint2;

            if (Idglib.FindCircleCircleIntersections(drawHere, armLength, hand2loc, armLength2, out CirclePoint1, out CirclePoint2) > 0)
            {
                Vector2 Circlepos = Owner.direction > 0 ? CirclePoint2 : CirclePoint1;
                Vector2 elbowloc  = Circlepos;
                Vector2 normal2   = elbowloc - drawHere;
                Vector2 normal3   = drawThere - elbowloc;

                Vector2 origin1 = new Vector2(armTex.Width / 2f, armLength);
                Vector2 origin2 = new Vector2(armTex2.Width / 2f, armLength2);

                returnfangle = normal3.ToRotation();

                spriteBatch.Draw(armTex, drawHere - Main.screenPosition, null, Color.White * projectile.Opacity, normal2.ToRotation() + angleoffset, origin1, scale, spriteEffects, 0f);
                spriteBatch.Draw(armTex2, Circlepos - Main.screenPosition, null, Color.White * projectile.Opacity, normal3.ToRotation() + angleoffset, origin2, scale, spriteEffects, 0f);

                //spriteBatch.Draw(TestTex, drawHere - Main.screenPosition, null, Color.White, 0, TestTex.Size() / 2f, scale, spriteEffects, 0f);
                //spriteBatch.Draw(TestTex, drawHere + dist1Tracker - Main.screenPosition, null, Color.White, 0, TestTex.Size() / 2f, scale, spriteEffects, 0f);
                //spriteBatch.Draw(TestTex, drawHere + dist1Tracker + dist2Tracker - Main.screenPosition, null, Color.White, 0, TestTex.Size() / 2f, scale, spriteEffects, 0f);
            }

            return(returnfangle);

            //spriteBatch.Draw(armTex, drawHere - Main.screenPosition, null, Color.White, angle + angleoffset, origin, scale, spriteEffects, 0f);

            //spriteBatch.Draw(armTex, arm2pos - Main.screenPosition, null, Color.White, angle2, origin, scale, spriteEffects, 0f);
        }