Ejemplo n.º 1
0
        /// <summary>
        /// 隐藏相机特效
        /// </summary>
        /// <param name="effectType">特效类型</param>
        public void HideEffect(CameraEffectType effectType)
        {
            ICameraEffect cameraEffect;

            m_CameraEffects.TryGetValue(effectType, out cameraEffect);
            if (cameraEffect == null)
            {
                Log.Error("Can no find cameraEffect by type:", effectType);
                return;
            }

            cameraEffect.Hide();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 淡出相机特效
        /// </summary>
        /// <param name="effectType">特效类型</param>
        /// <param name="fadeTime">淡出时间</param>
        /// <param name="callback">回调</param>
        public void FadeOutEffect(CameraEffectType effectType, float fadeTime, Action callback = null)
        {
            ICameraEffect cameraEffect;

            m_CameraEffects.TryGetValue(effectType, out cameraEffect);
            if (cameraEffect == null)
            {
                Log.Error("Can no find cameraEffect by type:", effectType);
                return;
            }

            cameraEffect.FadeOut(fadeTime, callback);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 显示相机特效
        /// </summary>
        /// <param name="effectType">特效类型</param>
        public void ShowEffect(CameraEffectType effectType)
        {
            if (effectType == CameraEffectType.Deafault)
            {
                HideAllEffect();
                return;
            }

            ICameraEffect cameraEffect;

            m_CameraEffects.TryGetValue(effectType, out cameraEffect);
            if (cameraEffect == null)
            {
                Log.Error("Can no find cameraEffect by type:", effectType);
                return;
            }

            cameraEffect.Show();
        }
Ejemplo n.º 4
0
    void LateUpdate()
    {
        if (m_target == null)
        {
            transform.position = pos + m_effects[m_currentEffect].pos(m_effectPower);
            m_effectTime      -= Time.deltaTime;
            if (m_effectTime < 0 && m_currentEffect != CameraEffectType.None)
            {
                m_currentEffect = CameraEffectType.None;
            }
            return;
        }

        var targetPos = m_target.transform.position;

        targetPos.z -= vOffset;

        var dir     = targetPos - pos;
        var dirNorm = dir.magnitude;

        if (dirNorm > 0.01f)
        {
            var speed = Mathf.Min(Mathf.Pow(dirNorm * m_speed, m_speedPower), m_maxCapedSpeed) * Time.deltaTime;
            if (speed > dirNorm)
            {
                speed = dirNorm;
            }
            dir *= speed / dirNorm;
            pos  = pos + dir;
        }
        transform.position = pos + m_effects[m_currentEffect].pos(m_effectPower);

        m_effectTime -= Time.deltaTime;
        if (m_effectTime < 0 && m_currentEffect != CameraEffectType.None)
        {
            m_currentEffect = CameraEffectType.None;
        }
    }
Ejemplo n.º 5
0
 public PlayCameraEffectEvent(CameraEffectType _effectType, float _power, float _time)
 {
     effectType = _effectType;
     power      = _power;
     time       = _time;
 }
Ejemplo n.º 6
0
 void onPlayEffect(PlayCameraEffectEvent e)
 {
     m_currentEffect = e.effectType;
     m_effectPower   = e.power;
     m_effectTime    = e.time;
 }
Ejemplo n.º 7
0
 void EffectDelegate(CameraEffectType type, CameraEffectArgs args)
 {
     if (cameraEffects.ContainsKey(type))
         foreach (CameraEffect effect in cameraEffects[type])
             effect.Play(args);
 }