void OnCollisionEnter2D(Collision2D col){ if(col.transform.tag == "AIArrow"){ MoveAIArrow arrowObject = col.gameObject.GetComponent <MoveAIArrow>(); Rigidbody2D arrowBody = arrowObject.GetComponent<Rigidbody2D>(); arrowBody.isKinematic = true; currentHealth = currentHealth - AIarcherController.attackDamage; HandleHealth (); } }
void OnCollisionEnter2D(Collision2D col) { if (col.transform.tag == "Mine" && animator.GetBool("canWork") == false) { animator.SetBool("canWork", true); StartCoroutine(MineGold()); } if (col.transform.tag == "AIArrow") { MoveAIArrow arrowObject = col.gameObject.GetComponent <MoveAIArrow>(); Rigidbody2D arrowBody = arrowObject.GetComponent <Rigidbody2D>(); arrowBody.isKinematic = true; health = health - AIarcherController.attackDamage; } if (col.transform.tag == "AIarcher" || col.transform.tag == "AIwarrior") { cantWalk = true; } }