39 lines
956 B
C#
39 lines
956 B
C#
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class PinballUncountableAddScoreFx : MonoBehaviour
|
|
{
|
|
[SerializeField] private Animation ani;
|
|
[SerializeField] private TMP_Text text;
|
|
private readonly string normal = "EventUncountablePinballScoreAdd", max = "EventUncountablePinballScoreAddMax";
|
|
|
|
private Action _onComplete;
|
|
|
|
public void PlayNormal(int score, Action onComplete = null)
|
|
{
|
|
gameObject.SetActive(true);
|
|
_onComplete = onComplete;
|
|
ani.Play(normal);
|
|
text.text = '+' + score.ToString();
|
|
}
|
|
|
|
public void PlayMax(Action onComplete = null)
|
|
{
|
|
gameObject.SetActive(true);
|
|
_onComplete = onComplete;
|
|
ani.Play(max);
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
// Call this from Animation Event at the end of animation clip
|
|
public void OnAnimationComplete()
|
|
{
|
|
_onComplete?.Invoke();
|
|
Hide();
|
|
}
|
|
} |