Hunter.OnTriggerEnter2D C# (CSharp) Method

OnTriggerEnter2D() public method

public OnTriggerEnter2D ( Collider2D col ) : void
col UnityEngine.Collider2D
return void
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.name == "BasementWallRight") //&& isCaught)
        {
            this.gameObject.SetActive(false);
        }

        //If the player collides with the patrolling enemy and is not caught and hunter is moving
        if (col.gameObject.tag == "Player" && !player.hide && speed>0) //&& isCaught)
        {
            player.canHide = false;
            player.killedByHunter = true;
            killPlayer = true;
            anim.SetBool("Kill", true);
            //stores instance of this in player

            player.hunterScript = this;
            //Monster stops moving
            speed = 0;
            player.normalSpeed = 0;
            player.SetInvisible();
            //anim.ResetTrigger("Kill");

            ////removed fip code, possibly needs an offset

            //If monster is facing left and the player is behind the monster OR monster is facing
            //right and player is behind the monster

            /*
            if ((!facingRight && (gameObject.transform.position.x < player.transform.position.x))
                 || (facingRight && (gameObject.transform.position.x > player.transform.position.x)))
            {
                //Flip the monster to face the player
                FlipEnemy();
            }
            */
        }
    }