Exemplo n.º 1
0
 public void setTargetIDlist(ENTargetType type, List <NPC> npcList)
 {
     m_minDistance = float.MaxValue;
     foreach (NPC item in npcList)
     {
         CheckAutoBattleTarget(type, item);
     }
 }
Exemplo n.º 2
0
 public void GetRangeTargetList(ENTargetType type, float range = 0, ActorType firstTargetType = ActorType.enNone)
 {
     m_searchTargetType  = type;
     m_searchTargetRange = range;
     m_minDistance       = float.MaxValue;
     m_minActor          = null;
     m_targetIDList.Clear();
     m_firstTargetType = firstTargetType;
     ActorManager.Singleton.ForEach(CheckTarget);
 }
Exemplo n.º 3
0
 //获得一定范围内的目标的列表
 void GetTargetList(Vector3 selfPos, ActorType actorType, ENCamp actorCamp, ENTargetType type, float range)
 {
     m_selfPos           = selfPos;
     m_selfActorType     = actorType;
     m_selfCamp          = actorCamp;
     m_searchTargetType  = type;
     m_searchTargetRange = range;
     m_targetIDList.Clear();
     ActorManager.Singleton.ForEach(CheckTarget);
 }
Exemplo n.º 4
0
 public void SetRoomTargetListToEnemy(ENTargetType type, List <NPC> npcList)
 {
     m_targetIDList.Clear();
     setTargetIDlist(type, npcList);
 }
Exemplo n.º 5
0
    //战斗托管时组建targetList
    void CheckAutoBattleTarget(ENTargetType type, Actor target)
    {
        if (target.Type == ActorType.enNPC)
        {
            NPC npc = target as NPC;
            if (npc.GetNpcType() == ENNpcType.enBlockNPC ||
                npc.GetNpcType() == ENNpcType.enFunctionNPC)
            {
                return;
            }
        }
        else if (target.Type == ActorType.enMain)
        {
            if (target.IsActorExit)
            {
                return;
            }
        }
        if (target.IsDead)
        {
            return;
        }
        switch (type)
        {
        case ENTargetType.enEnemy:
        {
            if (!ActorTargetManager.IsEnemy(Owner, target))
            {
                return;
            }
        }
        break;

        case ENTargetType.enFriendly:
        {
            if (!ActorTargetManager.IsFriendly(Owner, target))
            {
                return;
            }
        }
        break;

        case ENTargetType.enSelf:
        {
            if (Owner != target)
            {
                return;
            }
        }
        break;

        case ENTargetType.enNullTarget:
            break;

        case ENTargetType.enFriendlyAndSelf:
        {
            if (!ActorTargetManager.IsFriendly(Owner, target) && Owner != target)
            {
                return;
            }
        }
        break;

        default:
            break;
        }
        float distance = ActorTargetManager.GetTargetDistance(Owner.RealPos, target.RealPos);

        if (distance < m_minDistance)
        {
            m_minDistance = distance;
            m_minActor    = target;
        }
        m_targetIDList.Add(target.ID);
    }