Files
ichni_Official/Assets/Scripts/Game/GameElements/GeneralEffects/CameraTiltEffect.cs

56 lines
1.6 KiB
C#
Raw Normal View History

2025-07-10 08:42:30 -04:00
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class CameraTiltEffect : EffectBase
{
2026-03-14 03:13:10 -04:00
#region [] Effect Parameters
2025-07-10 08:42:30 -04:00
public float duration;
public Vector3 tiltValue;
public AnimationCurve tiltCurve;
2026-03-14 03:13:10 -04:00
GameCamera gameCamera=> GameManager.Instance.cameraManager.gameCamera;
2025-07-10 08:42:30 -04:00
Tweener tiltTweener;
2025-09-05 10:14:45 -04:00
Tweener tiltBackTweener;
2026-03-14 03:13:10 -04:00
#endregion
2025-07-10 08:42:30 -04:00
2026-03-14 03:13:10 -04:00
#region [] Initialization
2025-07-10 08:42:30 -04:00
public CameraTiltEffect(float duration, Vector3 tiltValue, AnimationCurve tiltCurve)
{
this.effectTime = duration;
this.duration = duration;
this.tiltValue = tiltValue;
this.tiltCurve = tiltCurve;
}
2026-03-14 03:13:10 -04:00
#endregion
2025-07-10 08:42:30 -04:00
2026-03-14 03:13:10 -04:00
#region [] Effect Pattern Overrides
2025-07-10 08:42:30 -04:00
public override void Recover()
{
tiltTweener?.Kill(true);
2025-09-05 10:14:45 -04:00
tiltBackTweener?.Kill(true);
gameCamera.cam.transform.localEulerAngles = Vector3.zero;
2025-07-10 08:42:30 -04:00
}
public override void PreExecute()
{
2025-09-05 10:14:45 -04:00
tiltTweener = gameCamera.cam.transform.DOBlendableLocalRotateBy(tiltValue, duration, RotateMode.FastBeyond360).SetEase(tiltCurve).Play();
2025-07-10 08:42:30 -04:00
}
public override void Adjust()
{
}
public override void Disrupt()
{
tiltTweener?.Kill();
2025-09-05 10:14:45 -04:00
tiltBackTweener = gameCamera.cam.transform.DOLocalRotate(Vector3.zero, 0.4f).SetEase(Ease.OutSine).Play();
2025-07-10 08:42:30 -04:00
}
2026-03-14 03:13:10 -04:00
#endregion
2025-07-10 08:42:30 -04:00
}
2026-03-14 03:13:10 -04:00
2025-07-10 08:42:30 -04:00
}