Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using TMPro;
- using DG.Tweening;
- public class DivideMultiplier : MonoBehaviour
- {
- public int Value;
- public GameObject textAnim;
- private TextMeshPro tmPro;
- public float animDuration;
- Sequence textAnimMultiplier;
- public List<GameObject> ballList = new List<GameObject>();
- public int Border = 0;
- void Start()
- {
- tmPro = textAnim.GetComponent<TextMeshPro>();
- }
- public void TextAnimMultiplier()
- {
- textAnimMultiplier.Kill();
- textAnimMultiplier = DOTween.Sequence();
- textAnimMultiplier.Append(textAnim.transform.DOScale(new Vector3(1.35f, 1.35f, 1f), animDuration / 2));
- textAnimMultiplier.Append(textAnim.transform.DOScale(Vector3.one, animDuration / 2));
- }
- private void OnTriggerEnter2D(Collider2D collision)
- {
- ballList.Add(collision.gameObject);
- Div(ref ballList);
- }
- public void Div(ref List<GameObject> lst) {
- if ((lst.Count - Border) == Value) {
- Border++;
- for (int i = Border; i < lst.Count; ++ i) {
- GameManager.instance.poolBalls.Despawn(lst[i]);
- }
- lst.RemoveRange(Border, lst.Count - Border);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement