示例#1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Left_Limit"))
        {
            Change_For_Right_Movementation();
        }

        if (collision.gameObject.CompareTag("Right_Limit"))
        {
            Change_For_Left_Movementation();
        }

        if (collision.gameObject.CompareTag("Up_Limit"))
        {
            Change_For_Down_Movementation();
        }

        if (collision.gameObject.CompareTag("Down_Limit"))
        {
            Change_For_Up_Movementation();
        }

        if (collision.gameObject.CompareTag("Player"))
        {
            _Health_System_Enemy_Script.Reduce_HP(15);
        }
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Left_Limit"))
        {
            _Right_Movementation = true;
            _Left_Movementation  = false;
        }

        if (collision.gameObject.CompareTag("Right_Limit"))
        {
            _Right_Movementation = false;
            _Left_Movementation  = true;
        }

        if (collision.gameObject.CompareTag("Player"))
        {
            _Health_System_Enemy_Script.Reduce_HP(15);
        }
    }