67 lines
2.0 KiB
C#
67 lines
2.0 KiB
C#
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.gameCamera.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);
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
} |