77 lines
2.2 KiB
C#
77 lines
2.2 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
|
|
{
|
|
public float duration;
|
|
public Vector3 tiltValue;
|
|
public AnimationCurve tiltCurve;
|
|
|
|
Transform gameCameraTransform => GameManager.instance.cameraManager.gameCamera.gameCamera.transform;
|
|
Tweener tiltTweener;
|
|
|
|
public CameraTiltEffect(float duration, Vector3 tiltValue, AnimationCurve tiltCurve)
|
|
{
|
|
this.effectTime = duration;
|
|
this.duration = duration;
|
|
this.tiltValue = tiltValue;
|
|
this.tiltCurve = tiltCurve;
|
|
}
|
|
|
|
public override void Recover()
|
|
{
|
|
tiltTweener?.Kill(true);
|
|
gameCameraTransform.localEulerAngles = Vector3.zero;
|
|
}
|
|
|
|
public override void PreExecute()
|
|
{
|
|
tiltTweener = gameCameraTransform.DOBlendableLocalRotateBy(tiltValue, duration, RotateMode.FastBeyond360).SetEase(tiltCurve);
|
|
}
|
|
|
|
public override void Adjust()
|
|
{
|
|
|
|
}
|
|
|
|
public override EffectBase_BM ConvertToBM()
|
|
{
|
|
return new CameraTiltEffect_BM(duration, tiltValue, tiltCurve);
|
|
}
|
|
|
|
public override void Disrupt()
|
|
{
|
|
tiltTweener?.Kill();
|
|
gameCameraTransform.DOLocalRotate(Vector3.zero, 0.4f);
|
|
}
|
|
}
|
|
|
|
namespace Beatmap
|
|
{
|
|
public class CameraTiltEffect_BM : EffectBase_BM
|
|
{
|
|
public float duration;
|
|
public Vector3 tiltValue;
|
|
public AnimationCurve tiltCurve;
|
|
|
|
public CameraTiltEffect_BM(float duration, Vector3 tiltValue, AnimationCurve tiltCurve)
|
|
{
|
|
this.effectTime = duration;
|
|
this.duration = duration;
|
|
this.tiltValue = tiltValue;
|
|
this.tiltCurve = tiltCurve;
|
|
|
|
}
|
|
|
|
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
|
|
{
|
|
return new CameraTiltEffect(duration, tiltValue, tiltCurve);
|
|
}
|
|
}
|
|
}
|
|
} |