// Start is called before the first frame update void Start() { if (!grimeController) { grimeController = GameObject.FindGameObjectWithTag("GrimeLayer").GetComponent <GrimeController>(); } }
// This method sets all the appropriate variables when the player enters the grime void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Grime") { _inGrime = true; _rb.velocity = Vector2.zero; _grimeController = other.GetComponent <GrimeController>(); _anim.SetBool("InGrime", true); } }