private void OnTriggerExit2D(Collider2D collider) { if (collider.gameObject.CompareTag("Player")) { inRange = false; gameObject.SetActive(false); enemyParent.triggerArea.SetActive(true); enemyParent.inRange = false; enemyParent.SelectTarget(); } }
private void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player") && !anim.GetBool("Death")) { //Debug.Log("HotZoneLeft"); //healthbar.transform.position = new Vector3(0, -1000, 0); inRange = false; gameObject.SetActive(false); enemyParent.triggerArea.SetActive(true); enemyParent.inRange = false; enemyParent.SelectTarget(); anim.SetBool("Attack", false); healthbar.transform.position = new Vector3(0, -1000, 0); GetComponentInParent <MobHealthBar>().hurt = false; } }
void Update() { if (WallDetection()) { //Debug.Log("WALLLLLLLLLLLLLL!!!!!"); if (!enemy_behaviour.InsideofLimits() && /*!enemy_behaviour.inRange && */ !enemy_behaviour.anim.GetCurrentAnimatorStateInfo(0).IsName("Skeleton_attack") && !enemy_behaviour.anim.GetCurrentAnimatorStateInfo(0).IsName("Skeleton_rage")) { enemy_behaviour.SelectTarget(); Invoke("TrigAreaActive", 1); } } if (currentHealth <= 0) { canFlip = false; enemy_behaviour.anim.SetBool("IsDead", true); rb.constraints = RigidbodyConstraints2D.FreezeAll; Die(); } }