31 lines
863 B
C#
31 lines
863 B
C#
using UnityEngine;
|
|
using PrimeTween;
|
|
|
|
namespace Code.Gameplay.Coin
|
|
{
|
|
public class Coin : MonoBehaviour
|
|
{
|
|
public Vector3 rotationAngle = new(0, 360, 0);
|
|
public float rotationDuration = 10f;
|
|
|
|
public float amplitude = 0.5f;
|
|
public float cycleDuration = 2f;
|
|
|
|
private void Start()
|
|
{
|
|
Tween.LocalEulerAngles(transform,
|
|
startValue: Vector3.zero,
|
|
endValue: rotationAngle,
|
|
duration: rotationDuration,
|
|
cycles: -1,
|
|
ease: Ease.Linear);
|
|
|
|
Tween.LocalPositionY(transform,
|
|
endValue: transform.localPosition.y + amplitude,
|
|
duration: cycleDuration / 2,
|
|
cycles: -1,
|
|
cycleMode: CycleMode.Yoyo,
|
|
ease: Ease.InOutSine);
|
|
}
|
|
}
|
|
} |