Esempio n. 1
0
        public static void PvPSelectRemoteAvatar(BaseMonoAvatar aAvatar)
        {
            List <BaseMonoAvatar> allAvatars = Singleton <AvatarManager> .Instance.GetAllAvatars();

            List <BaseMonoPropObject> allPropObjects = Singleton <PropObjectManager> .Instance.GetAllPropObjects();

            if ((allAvatars.Count != 0) || (allPropObjects.Count != 0))
            {
                Vector3 forward = Singleton <CameraManager> .Instance.GetMainCamera().Forward;

                if (aAvatar.GetActiveControlData().hasSteer)
                {
                    forward = aAvatar.GetActiveControlData().steerDirection;
                }
                forward.y = 0f;
                float          eccentricity  = 0.9f;
                BaseMonoEntity monsterTarget = null;
                float          maxValue      = float.MaxValue;
                FilterAvatarTargetByEllipse(aAvatar, allAvatars, forward, eccentricity, ref monsterTarget, ref maxValue);
                BaseMonoEntity newTarget = null;
                float          num3      = float.MaxValue;
                for (int i = 0; i < allPropObjects.Count; i++)
                {
                    BaseMonoPropObject entity = allPropObjects[i];
                    if ((entity.IsActive() && !entity.denySelect) && Singleton <CameraManager> .Instance.GetMainCamera().IsEntityVisible(entity))
                    {
                        float num5 = 1.5f * GetScoreByEllipse(aAvatar, entity, forward, eccentricity);
                        if (num5 < num3)
                        {
                            newTarget = entity;
                            num3      = num5;
                        }
                    }
                }
                if ((monsterTarget == null) || (newTarget == null))
                {
                    if (monsterTarget != null)
                    {
                        aAvatar.SetAttackTarget(monsterTarget);
                    }
                    else if (newTarget != null)
                    {
                        aAvatar.SetAttackTarget(newTarget);
                    }
                    else
                    {
                        aAvatar.SetAttackTarget(null);
                    }
                }
                else
                {
                    BaseMonoEntity entity3 = (maxValue >= num3) ? newTarget : monsterTarget;
                    aAvatar.SetAttackTarget(entity3);
                }
            }
        }
Esempio n. 2
0
        public static void SelectNearestEnemyV1(BaseMonoAvatar aAvatar)
        {
            List <BaseMonoMonster> monsters = new List <BaseMonoMonster>();

            foreach (BaseMonoMonster monster in Singleton <MonsterManager> .Instance.GetAllMonsters())
            {
                if (monster.IsActive() && !monster.denySelect)
                {
                    monsters.Add(monster);
                }
            }
            if (monsters.Count != 0)
            {
                BaseMonoEntity attackTarget = null;
                if (monsters.Count > 0)
                {
                    FilterNearestMonsterTarget(aAvatar, monsters, ref attackTarget);
                }
                else
                {
                    attackTarget = null;
                }
                aAvatar.SetAttackTarget(attackTarget);
            }
        }
Esempio n. 3
0
        public static void SelectEnemyByEllipse(BaseMonoAvatar aAvatar)
        {
            List <BaseMonoMonster> monsters = new List <BaseMonoMonster>();

            foreach (BaseMonoMonster monster in Singleton <MonsterManager> .Instance.GetAllMonsters())
            {
                if (monster.IsActive() && !monster.denySelect)
                {
                    monsters.Add(monster);
                }
            }
            if (monsters.Count != 0)
            {
                BaseMonoEntity entity;
                Vector3        forward = Singleton <CameraManager> .Instance.GetMainCamera().Forward;

                if (aAvatar.GetActiveControlData().hasSteer)
                {
                    forward = aAvatar.GetActiveControlData().steerDirection;
                }
                forward.y = 0f;
                if (monsters.Count > 0)
                {
                    entity = monsters[0];
                    float eccentricity = 0.9f;
                    float monsterScore = GetScoreByEllipse(aAvatar, entity, forward, eccentricity);
                    FilterMonsterTargetByEllipse(aAvatar, monsters, forward, eccentricity, ref entity, ref monsterScore);
                }
                else
                {
                    entity = null;
                }
                aAvatar.SetAttackTarget(entity);
            }
        }