Ejemplo n.º 1
0
 private static void FilterMonsterTargetByEllipse(BaseMonoAvatar aAvatar, List <BaseMonoMonster> monsters, Vector3 mainDirection, float eccentricity, ref BaseMonoEntity monsterTarget, ref float monsterScore)
 {
     for (int i = 0; i < monsters.Count; i++)
     {
         BaseMonoMonster target = monsters[i];
         if (!target.denySelect && target.IsActive())
         {
             List <BaseMonoAbilityEntity> allHitboxEnabledBodyParts = target.GetAllHitboxEnabledBodyParts();
             if (allHitboxEnabledBodyParts.Count > 0)
             {
                 foreach (BaseMonoAbilityEntity entity in allHitboxEnabledBodyParts)
                 {
                     float num2 = GetScoreByEllipse(aAvatar, entity, mainDirection, eccentricity);
                     if (num2 < monsterScore)
                     {
                         monsterTarget = entity;
                         monsterScore  = num2;
                     }
                 }
             }
             else
             {
                 float num3 = GetScoreByEllipse(aAvatar, target, mainDirection, eccentricity);
                 if (num3 < monsterScore)
                 {
                     monsterTarget = target;
                     monsterScore  = num3;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        protected BaseMonoEntity SelectTarget()
        {
            List <BaseMonoMonster> allMonsters = Singleton <MonsterManager> .Instance.GetAllMonsters();

            BaseMonoEntity entity   = null;
            float          maxValue = float.MaxValue;

            for (int i = 0; i < allMonsters.Count; i++)
            {
                BaseMonoMonster monster = allMonsters[i];
                if (monster.IsActive() && !monster.denySelect)
                {
                    List <BaseMonoAbilityEntity> allHitboxEnabledBodyParts = monster.GetAllHitboxEnabledBodyParts();
                    if (allHitboxEnabledBodyParts.Count > 0)
                    {
                        foreach (BaseMonoAbilityEntity entity2 in allHitboxEnabledBodyParts)
                        {
                            float num3 = Miscs.DistancForVec3IgnoreY(entity2.XZPosition, this._avatar.XZPosition);
                            if ((!this.hasDistanceLimit || ((num3 >= this.minDistance) && (num3 <= this.maxDistance))) && (num3 < maxValue))
                            {
                                maxValue = num3;
                                entity   = entity2;
                            }
                        }
                    }
                    else
                    {
                        float num4 = Miscs.DistancForVec3IgnoreY(monster.XZPosition, this._avatar.XZPosition);
                        if ((!this.hasDistanceLimit || ((num4 >= this.minDistance) && (num4 <= this.maxDistance))) && (num4 < maxValue))
                        {
                            maxValue = num4;
                            entity   = monster;
                        }
                    }
                }
            }
            if ((entity != null) && entity.IsActive())
            {
                return(entity);
            }
            return(null);
        }