Update LBJCatMove.cs

This commit is contained in:
Rapandrasmus 2024-03-03 03:05:50 +01:00 committed by GitHub
parent b42ceb2264
commit 7e9e3c1e04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,16 +22,16 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
private void Awake() private void Awake()
{ {
_thisPosition = transform.position; _thisPosition = transform.localPosition;
if (_usePoint) if (_usePoint)
{ {
_otherPosition = _otherPoint.position; _otherPosition = _otherPoint.localPosition;
} }
else else
{ {
_otherPosition = _thisPosition + new Vector3(_slideOffset / 2, 0); _otherPosition = _thisPosition + new Vector3(_slideOffset / 2, 0);
} }
if (_startAtOther) transform.position = _otherPosition; if (_startAtOther) transform.localPosition = _otherPosition;
} }
public void Move(double beat, double length, bool inToScene) public void Move(double beat, double length, bool inToScene)
@ -44,7 +44,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
{ {
if (length <= 0) if (length <= 0)
{ {
transform.position = inToScene ? _thisPosition : _otherPosition; transform.localPosition = inToScene ? _thisPosition : _otherPosition;
yield break; yield break;
} }
float normalized = Conductor.instance.GetPositionFromBeat(beat, length, false); float normalized = Conductor.instance.GetPositionFromBeat(beat, length, false);
@ -52,7 +52,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
{ {
normalized = Conductor.instance.GetPositionFromBeat(beat, length); normalized = Conductor.instance.GetPositionFromBeat(beat, length);
Vector3 newPos = Vector3.Lerp(inToScene ? _otherPosition : _thisPosition, inToScene ? _thisPosition : _otherPosition, normalized); Vector3 newPos = Vector3.Lerp(inToScene ? _otherPosition : _thisPosition, inToScene ? _thisPosition : _otherPosition, normalized);
transform.position = newPos; transform.localPosition = newPos;
yield return null; yield return null;
} }
} }