//获得一定范围内的目标的列表
 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);
 }
Example #2
0
    static public bool IsFriendly(Actor self, Actor target)
    {
        if (self == target)
        {
            return(false);
        }
        ENCamp selfCamp = (ENCamp)self.Camp;

        if (selfCamp != self.TempCamp)
        {
            selfCamp = self.TempCamp;
        }
        ActorType selfType = self.Type;

        if (selfType != self.TempType)
        {
            selfType = self.TempType;
        }
        return(ActorTargetManager.IsFriendly(selfCamp, selfType, target));
    }
Example #3
0
    static public bool IsFriendly(ENCamp selfCamp, ActorType selfType, Actor target)
    {
        if (selfCamp != ENCamp.enNone)
        {
            ENCamp targetCamp = (ENCamp)target.TempCamp;
            switch (selfCamp)
            {
            case ENCamp.enRed:
            {
                if (targetCamp == ENCamp.enRed ||
                    targetCamp == ENCamp.enNeutralFriend)
                {
                    return(true);
                }
            }
            break;

            case ENCamp.enBlue:
            {
                if (targetCamp == ENCamp.enBlue ||
                    targetCamp == ENCamp.enNeutralFriend)
                {
                    return(true);
                }
            }
            break;

            case ENCamp.enYellow:
            {
                if (targetCamp == ENCamp.enYellow ||
                    targetCamp == ENCamp.enNeutralFriend)
                {
                    return(true);
                }
            }
            break;

            case ENCamp.enNeutralHostile:
            {
                return(false);
            }

//                    break;
            case ENCamp.enNeutralFriend:
            {
                return(true);
            }
//                    break;
            }
            return(false);
        }
        switch (selfType)
        {
        case ActorType.enMain:
        case ActorType.enSwitch:
        case ActorType.enPlayer:
        case ActorType.enFollow:
        case ActorType.enNPC_Friend:
        case ActorType.enPlayer_Sneak:
            if (target.Type == ActorType.enNPC)
            {
                NPC npc = target as NPC;
                if (npc.GetNpcType() == ENNpcType.enBoxNPC)     //todo,区别NPC类型,2暂定为不能被攻击的
                {
                    return(true);
                }
                if (target.TempType == ActorType.enNPC_Friend)
                {    //友方npc
                    return(true);
                }
            }
            else if (ActorType.enMold == target.Type)
            {
                return(false);
            }
            else
            {
                return(true);
            }
            break;

        case ActorType.enNPC:
        {
            if (target.Type == ActorType.enNPC)
            {
                NPC       npc  = target as NPC;
                ENNpcType type = npc.GetNpcType();
                if (type == ENNpcType.enCommonNPC || type == ENNpcType.enBOSSNPC || type == ENNpcType.enEliteNPC ||
                    type == ENNpcType.enMobaNpc || type == ENNpcType.enMobaTower)
                {
                    return(true);
                }
            }
        }
        break;

        case ActorType.enNPC_AllEnemy:
            break;

        default:
            break;
        }
        return(false);
    }
Example #4
0
    static public bool IsEnemy(ENCamp selfCamp, ActorType selfType, Actor target)
    {
        if (selfCamp != ENCamp.enNone)
        {
            ENCamp targetCamp = (ENCamp)target.TempCamp;
            switch (selfCamp)
            {
            case ENCamp.enRed:
            {
                if (targetCamp == ENCamp.enRed ||
                    targetCamp == ENCamp.enNeutralFriend)
                {
                    return(false);
                }
            }
            break;

            case ENCamp.enBlue:
            {
                if (targetCamp == ENCamp.enBlue ||
                    targetCamp == ENCamp.enNeutralFriend)
                {
                    return(false);
                }
            }
            break;

            case ENCamp.enYellow:
            {
                if (targetCamp == ENCamp.enYellow ||
                    targetCamp == ENCamp.enNeutralFriend)
                {
                    return(false);
                }
            }
            break;

            case ENCamp.enNeutralHostile:
            {
                return(true);
            }

            //break;
            case ENCamp.enNeutralFriend:
            {
                return(false);
            }
                //break;
            }
            return(true);
        }
        switch (selfType)
        {
        case ActorType.enMain:
        case ActorType.enSwitch:
        case ActorType.enPlayer:
        case ActorType.enFollow:
        case ActorType.enPlayer_Sneak:
            if (target.Type == ActorType.enNPC)
            {    //npc
                NPC       npc     = target as NPC;
                ENNpcType npcType = npc.GetNpcType();
                if (npcType == ENNpcType.enFunctionNPC ||
                    npcType == ENNpcType.enBlockNPC ||
                    npcType == ENNpcType.enBoxNPC)     //todo,区别NPC类型,2暂定为不能被攻击的
                {
                }
                else
                {
                    return(true);
                }
            }
            if (target.Type == ActorType.enNPCTrap)
            {    //机关
                return(false);
            }
            break;

        case ActorType.enNPC_Friend:
        {
            if (target.Type == ActorType.enNPC)
            {
                NPC       npc     = target as NPC;
                ENNpcType npcType = npc.GetNpcType();
                if (npcType == ENNpcType.enFunctionNPC ||
                    npcType == ENNpcType.enBlockNPC ||
                    npcType == ENNpcType.enBoxNPC)         //todo,区别NPC类型,2暂定为不能被攻击的
                {
                }
                else
                {
                    if (target.TempType == ActorType.enNPC_Friend)
                    {        //友方npc不能互相攻击
                        ;
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
        }
        break;

        case ActorType.enNPC:
            if (ActorType.enMain == target.Type || ActorType.enFollow == target.Type)
            {
                if (target.TempType == ActorType.enPlayer_Sneak)
                {
                    ;
                }
                else
                {
                    return(true);
                }
            }
            break;

        case ActorType.enNPC_AllEnemy:
            if (target.Type == ActorType.enNPC)
            {
                NPC       npc     = target as NPC;
                ENNpcType npcType = npc.GetNpcType();
                if (npcType == ENNpcType.enFunctionNPC ||
                    npcType == ENNpcType.enBlockNPC ||
                    npcType == ENNpcType.enBoxNPC)     //todo,区别NPC类型,2暂定为不能被攻击的
                {
                }
                else
                {
                    return(true);
                }
            }
            else if (target.Type == ActorType.enNPCTrap)
            {
                return(false);
            }
            else
            {
                return(true);
            }
            break;

        case ActorType.enNPCTrap:
        {
            return(true);
        }

//                break;
        default:
            break;
        }
        return(false);
    }