using System; using UnityEngine; [RequireComponent(typeof(BoxCollider))] public class Coin : MonoBehaviour, ICollectable,IResettable { [SerializeField] private int coinValue; private SinAnimator sinAnimator; public Renderer Renderer { get; private set; } public BoxCollider Collider { get; private set; } public static event Action OnCoinCollected; public static event Action OnCoinDissapeared; private void Awake() { Renderer = GetComponent(); Collider = GetComponent(); sinAnimator = GetComponent(); } public void Collect() { gameObject.SetActive(false); OnCoinCollected?.Invoke(coinValue); OnCoinDissapeared?.Invoke(this); } public void UpdateStartPositionForSinAnimator() { sinAnimator.UpdateStartPosition(); } public void ResetToDefault() { //gameObject.transform.localRotation = Quaternion.identity; //gameObject.transform.localScale = Vector3.one; //gameObject.transform.localPosition = Vector3.zero; //gameObject.SetActive(true); // gameObject.transform.SetParent(null); } }