コード例 #1
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     //Check if we collide with the player, if that's true, try to follow him
     if (collision.tag == "Player" && Vector3.Distance(transform.position, collision.transform.position) > MinDistance)
     {
         //Get Enemy Selector cmp and check if it can be follow
         EnemySelector EnmSlt = collision.gameObject.GetComponentInChildren <EnemySelector>();
         if (EnmSlt && EnmSlt.CanBeFollowed(this.gameObject))
         {
             EnemyBehaviour.AskFollow(collision.gameObject);
         }
     }
 }