/// <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(); }
/// <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); }
/// <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(); }
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; } }
public PlayCameraEffectEvent(CameraEffectType _effectType, float _power, float _time) { effectType = _effectType; power = _power; time = _time; }
void onPlayEffect(PlayCameraEffectEvent e) { m_currentEffect = e.effectType; m_effectPower = e.power; m_effectTime = e.time; }
void EffectDelegate(CameraEffectType type, CameraEffectArgs args) { if (cameraEffects.ContainsKey(type)) foreach (CameraEffect effect in cameraEffects[type]) effect.Play(args); }