Untitled
unknown
plain_text
3 years ago
782 B
19
Indexable
public class Plant : MonoBehaviour { private Animator anim; [SerializeField] private AudioClip brush; void Start() { anim = GetComponent<Animator>(); } private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player" || collision.gameObject.tag == "NPCs") { anim.SetBool("brush", true); } if (collision.gameObject.tag != "Player") { SoundManager.instance.PlaySound(brush); } } private void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject.tag == "Player" || collision.gameObject.tag == "NPCs") { anim.SetBool("brush", false); } } }
Editor is loading...