Beispiel #1
0
    /// <summary>
    /// 获取颜色
    /// </summary>
    /// <param name="tid">tid</param>
    public static Color GetColorByTable(int tid)
    {
        CfgEternityProxy cfgEternityProxy = (CfgEternityProxy)GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy);

        return(cfgEternityProxy.GetGlobalColor(tid));
    }
Beispiel #2
0
    public void ChangeEffect(float distance, uint signalTid, bool isActive = false)
    {
        /// 解决异步加载问题
        m_OnGet = true;
        if (!m_OnLoaded)
        {
            m_Distance  = distance;
            m_SignalTid = signalTid;
            m_IsActive  = isActive;
            return;
        }
        m_OnGet = false;

        /// 未激活时特效为白色
        if (!m_IsActive)
        {
            ChangeParticleColor(Color.white);
            return;
        }

        TreasureSignal signalVO = m_CfgEternityProxy.TreasureSignalsByKey(signalTid);
        float          wDis     = signalVO.WeakSignalDistance;
        float          mDis     = signalVO.MediumSignalDistance;
        float          sDis     = signalVO.StrongSignalDistance;
        DistanceType   endType  = DistanceType.none;
        float          far      = 0;
        float          near     = 0;

        /// 判断从小圈到大圈
        if (distance < sDis)
        {
            far         = sDis;
            near        = signalVO.DiscoveryDistance;
            m_StartType = DistanceType.strong;
            endType     = DistanceType.discovery;
        }
        else if (distance < mDis)
        {
            far         = mDis;
            near        = sDis;
            m_StartType = DistanceType.medium;
            endType     = DistanceType.strong;
        }
        else if (distance < wDis)
        {
            far         = wDis;
            near        = mDis;
            m_StartType = DistanceType.weak;
            endType     = DistanceType.medium;
        }

        /// 探测器可能在圈外
        if (m_StartType == DistanceType.none)
        {
            ChangeParticleColor(Color.white);
            return;
        }

        float lerp       = (far - distance) / (far - near);
        Color startColor = m_CfgEternityProxy.GetGlobalColor((int)m_Colors[m_StartType]);
        Color endColor   = m_CfgEternityProxy.GetGlobalColor((int)m_Colors[endType]);
        Color curColor   = Color.Lerp(startColor, endColor, lerp);
        float curRate    = m_Frequencys[m_StartType] + (m_Frequencys[endType] - m_Frequencys[m_StartType]) * lerp;

        ///ChangeMaterial(MATERIAL_NAME, curColor, curRate);
        ChangeParticleColor(curColor, curRate);

        /// 音效,先停再播最新的
        if (m_TreasureHuntProxy.GetCurDetectorTransfrom())
        {
            WwiseUtil.PlaySound(m_Sounds[DistanceType.none], false, m_TreasureHuntProxy.GetCurDetectorTransfrom());
        }
        WwiseUtil.PlaySound(m_Sounds[m_StartType], false, m_Property.GetRootTransform());
        m_TreasureHuntProxy.SetCurDetectorSoundInfo(m_Property.GetUId(), m_Property.GetRootTransform());
    }