using Code.Audio; using Code.GameplayServices; using LitMotion; using LitMotion.Extensions; using UnityEngine; namespace Code.PassingObjects { public class CoinBooster : PassingObject { private MotionHandle _movementAnim; private MotionHandle _rotationAnim; private void OnTriggerEnter(Collider other) { BonusService.Instance.GiveCoinBoost().Forget(); AudioManager.Instance.PlayPowerUp(); PassingObjectsManager.Instance.KillChild(this); } private void Start() { _rotationAnim = LMotion.Create(Quaternion.Euler(0,0,0), Quaternion.Euler(0,180,0), 1) .WithLoops(123) .BindToRotation(transform); _movementAnim = LMotion.Create(0.5f, 1.5f, 1) .WithLoops(123, LoopType.Yoyo) .BindToPositionY(transform); } private void OnDestroy() { _rotationAnim.Cancel(); _movementAnim.Cancel(); } } }