56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DG.Tweening;
|
|
using Ichni.RhythmGame.Beatmap;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public class CameraTiltEffect : EffectBase
|
|
{
|
|
#region [效果参数] Effect Parameters
|
|
public float duration;
|
|
public Vector3 tiltValue;
|
|
public AnimationCurve tiltCurve;
|
|
|
|
GameCamera gameCamera=> GameManager.Instance.cameraManager.gameCamera;
|
|
Tweener tiltTweener;
|
|
Tweener tiltBackTweener;
|
|
#endregion
|
|
|
|
#region [初始化] Initialization
|
|
public CameraTiltEffect(float duration, Vector3 tiltValue, AnimationCurve tiltCurve)
|
|
{
|
|
this.effectTime = duration;
|
|
this.duration = duration;
|
|
this.tiltValue = tiltValue;
|
|
this.tiltCurve = tiltCurve;
|
|
}
|
|
#endregion
|
|
|
|
#region [效果逻辑覆盖] Effect Pattern Overrides
|
|
public override void Recover()
|
|
{
|
|
tiltTweener?.Kill(true);
|
|
tiltBackTweener?.Kill(true);
|
|
gameCamera.cam.transform.localEulerAngles = Vector3.zero;
|
|
}
|
|
|
|
public override void PreExecute()
|
|
{
|
|
tiltTweener = gameCamera.cam.transform.DOBlendableLocalRotateBy(tiltValue, duration, RotateMode.FastBeyond360).SetEase(tiltCurve).Play();
|
|
}
|
|
public override void Adjust()
|
|
{
|
|
}
|
|
|
|
public override void Disrupt()
|
|
{
|
|
tiltTweener?.Kill();
|
|
tiltBackTweener = gameCamera.cam.transform.DOLocalRotate(Vector3.zero, 0.4f).SetEase(Ease.OutSine).Play();
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
|
|
} |