Ejemplo n.º 1
0
        public static ShotStrength CalculateShotStrength(Projectile golfHelper, Entity golfBall)
        {
            int num = Main.screenWidth;

            if (num > Main.screenHeight)
            {
                num = Main.screenHeight;
            }
            int num2 = 150;

            num -= num2;
            num /= 2;
            if (num < 200)
            {
                num = 200;
            }
            float num3 = num;

            num3 = 300f;
            if (golfHelper.ai[0] != 0f)
            {
                return(default(ShotStrength));
            }
            Vector2        shotVector = (golfHelper.Center - golfBall.Center) / num3;
            ClubProperties clubPropertiesFromGolfHelper = GetClubPropertiesFromGolfHelper(golfHelper);

            return(CalculateShotStrength(shotVector, clubPropertiesFromGolfHelper));
        }
Ejemplo n.º 2
0
        private static ShotStrength CalculateShotStrength(Vector2 shotVector, ClubProperties clubProperties)
        {
            Vector2.Normalize(shotVector);
            float value            = shotVector.Length();
            float num              = FindVectorOnOval(shotVector, clubProperties.MaximumStrength).Length();
            float num2             = FindVectorOnOval(shotVector, clubProperties.MinimumStrength).Length();
            float num3             = MathHelper.Clamp(value, num2, num);
            float relativeStrength = Math.Max((num3 - num2) / (num - num2), 0.001f);

            return(new ShotStrength(num3 * 32f, relativeStrength, clubProperties.RoughLandResistance));
        }