private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Person")) { people = other.GetComponentInParent <PatrolPeople>(); peopleInteract = other.GetComponentInParent <InteractBuy>(); people.stopPath(); if (peopleInteract.CanBuy) { isTalking = true; GameManager.instance.SetInteractText("Presiona 'E' para interactuar", true); } else { if (GameControl.instance.Charity) { GameManager.instance.SetInteractText("No tengo", true); } else { GameManager.instance.SetInteractText("No, gracias", true); } } } else if (other.gameObject.CompareTag("Enemy")) { enemy = other.GetComponentInParent <Patrol>(); if (enemy.canFollow) { enemyArrest = other.GetComponent <InteractArrest>(); openArrestDialog(); } } }
void resetBehaviourEnemy() { if (enemy != null && enemyArrest != null) { enemy.cancelFollow(); enemy = null; enemyArrest = null; } }