using System.Collections; using System.Collections.Generic; using DG.Tweening; using Ichni.RhythmGame.Beatmap; using Lean.Pool; using MoreMountains.Feedbacks; using UnityEngine; namespace Ichni.RhythmGame { public class CameraOffsetEffect : EffectBase { public float duration; public Vector3 offsetValue; public AnimationCurve offsetCurve; Transform gameCameraTransform => GameManager.instance.cameraManager.gameCamera.cam.transform; Tweener offsetTweener; public CameraOffsetEffect(float duration, Vector3 offsetValue, AnimationCurve offsetCurve) { this.effectTime = this.duration; this.duration = duration; this.offsetValue = offsetValue; this.offsetCurve = offsetCurve; } public override void Recover() { offsetTweener?.Kill(true); gameCameraTransform.localPosition = Vector3.zero; } public override void PreExecute() { offsetTweener = gameCameraTransform.DOBlendableLocalMoveBy(offsetValue, duration).SetEase(offsetCurve).Play(); } public override void Adjust() { } public override void Disrupt() { offsetTweener?.Kill(); gameCameraTransform.DOLocalMove(Vector3.zero, 0.4f).Play(); } public override EffectBase_BM ConvertToBM() { return new CameraOffsetEffect_BM(duration, offsetValue, offsetCurve); } } namespace Beatmap { public class CameraOffsetEffect_BM : EffectBase_BM { public float duration; public Vector3 offsetValue; public AnimationCurve offsetCurve; public CameraOffsetEffect_BM(float duration, Vector3 offsetValue, AnimationCurve offsetCurve) { this.effectTime = duration; this.duration = duration; this.offsetValue = offsetValue; this.offsetCurve = offsetCurve; } public override EffectBase ConvertToGameType(GameElement attachedGameElement) { return new CameraOffsetEffect(duration, offsetValue, offsetCurve); } } } }