Example #1
0
    public bool CanAttackToTarget(SpacecraftEntity attacker, SpacecraftEntity target)
    {
        if (attacker == null || target == null)
        {
            return(false);
        }

        //优先判断是否可被攻击
        if (!target.GetCanBeAttack())
        {
            return(false);
        }

        CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;

        //直接调用获取阵营关系的函数,岂不简单些?
        CampRelation relation = cfgEternityProxy.GetRelation(attacker.GetCampID(), target.GetCampID());

        return(relation == CampRelation.Enemy);

        //int attCamp = attacker.GetCampID();
        //int tarCamp = target.GetCampID();
        //CampVO_MergeObject? campVO = cfgCampProxy.GetCampRelationVO(attCamp, tarCamp);
        //if (campVO == null)
        //{
        //	Debug.LogErrorFormat("阵营信息不存在. Camp1: {0}, Camp2: {1}", attCamp, tarCamp);
        //	return false;
        //}
        //else
        //{
        //	int prestage = attacker.GetPrestige(tarCamp);
        //	// 通过声望值判断是否可攻击
        //	return prestage > campVO.Value.PrestigeEnemyMin && prestage < campVO.Value.PrestigeEnemyMax;
        //}
    }
Example #2
0
    /// <summary>
    /// 获取模板
    /// </summary>
    /// <param name="main">主角</param>
    /// <param name="target">目标</param>
    /// <returns>模板</returns>
    private RectTransform GetTemplate(SpacecraftEntity main, SpacecraftEntity target)
    {
        switch (target.GetHeroType())
        {
        case KHeroType.htMonster:
            return(m_CfgEternityProxy.GetRelation(main.GetCampID(), target.GetCampID()) == CampRelation.Enemy ? m_EnemyTemplate : m_UAVTemplate);

        case KHeroType.htEliteMonster2:
            return(m_BossTemplate);

        case KHeroType.htPlayer:
            return(m_FriendTemplate);

        case KHeroType.htNpc:
            return(m_NpcTemplate);

        case KHeroType.htMine:
            return(m_MineralTemplate);

        case KHeroType.htPreicous:
        case KHeroType.htDetector:
            return(m_DetectorTemplate);

        case KHeroType.htRareChestGuard:
            return(m_BossTemplate);

        case KHeroType.htNormalChestGuard:
            return(m_EnemyTemplate);

        case KHeroType.htDisturbor:
            return(m_EnemyTemplate);

        case KHeroType.htBeEscortedNpc:
            return(m_EscortTemplate);

        default:
            Debug.Log(target + "===类型不对==" + target.GetHeroType());
            return(m_EnemyTemplate);
        }
        return(null);
    }