using System.Collections; using System.Collections.Generic; using UnityEngine; public class ProjectileBehavior : MonoBehaviour { public bool pinned = false; public void Explode() { Destroy(this.gameObject); } public void Pin() { this.gameObject.GetComponent().constraints = RigidbodyConstraints2D.FreezeAll; this.gameObject.GetComponent().enabled = false; } public void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "wall" || col.gameObject.tag == "Player") { Explode(); } } }