using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ThirdLevelBoxTarget : MonoBehaviour
{
    public ThirdLevelBoxCollision m_levelBoxCollison;
    private void OnTriggerEnter(Collider other)
    {
        if (other != null && other.gameObject && other.gameObject.GetComponent<TargetView>() != null
            && other.gameObject.GetComponent<TargetView>().parentTrans != null)
        {
            GameObject varObj = other.gameObject.GetComponent<TargetView>().parentTrans.gameObject;
            if (string.Equals(varObj.name, "Boy_01"))
            {
                TargetView varView = varObj.GetComponent<TargetView>();
                if(!varView.rigidBody)
                {
                    return;
                }
                BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
                m_levelBoxCollison.SetEnterTarget();
                if (varView)
                {
                    varView.DestroyRigidByOther();
                }
            }
        }
    }
}
