コード例 #1
0
ファイル: Movement.cs プロジェクト: sycs/kaihaider
        /// stolen from singular
        /// <summary>
        /// calculate a unit's vertical distance (height) above ground level (mesh).  this is the units position
        /// relative to the ground and is independent of any other character.
        /// </summary>
        /// <param name="u">unit</param>
        /// <returns>float.MinValue if can't determine, otherwise distance off ground</returns>
        public static float HeightOffTheGround(this Styx.WoWInternals.WoWObjects.WoWUnit u)
        {
            var unitLoc   = new WoWPoint(u.Location.X, u.Location.Y, u.Location.Z);
            var listMeshZ = Navigator.FindHeights(unitLoc.X, unitLoc.Y).Where(h => h <= unitLoc.Z);

            if (listMeshZ.Any())
            {
                return(unitLoc.Z - listMeshZ.Max());
            }

            return(float.MaxValue);
        }
コード例 #2
0
ファイル: Movement.cs プロジェクト: sycs/kaihaider
        /// stolen from singular
        /// <summary>
        /// determines if a target is off the ground far enough that you can
        /// reach it with melee spells if standing directly under.
        /// </summary>
        /// <param name="u">unit</param>
        /// <returns>true if above melee reach</returns>
        public static bool IsAboveTheGround(this Styx.WoWInternals.WoWObjects.WoWUnit u)
        {
            float height = HeightOffTheGround(u);

            if (height == float.MaxValue)
            {
                return(false);   // make this true if better to assume aerial
            }
            if (height > System.Math.Max(Helpers.Rogue.me.CombatReach - 0.1f + u.CombatReach, 2.5f))
            {
                return(true);
            }

            return(false);
        }