using System.Collections; using System.Collections.Generic; using UnityEngine; public class ChangeSize2D : MonoBehaviour { public int lives = 5; public float step = 0.15f; public string ignoreTag = ""; public bool increase = false; bool was = false; void OnTriggerEnter2D(Collider2D other) { if (other.tag == ignoreTag || was == true) { return; } lives--; if (lives <= 0) { Destroy(gameObject); } if (increase == true) { transform.localScale += new Vector3(step, step, 0); } else { transform.localScale -= new Vector3(step, step, 0); } was = true; Invoke("Restart", 0.1f); } void Restart() { was = false; } }