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

public class RightClawTrigger : MonoBehaviour
{
    private void Awake()
    {
        //Mesh mesh = transform.GetComponent<MeshFilter>().mesh;
        //MeshCollider col = this.GetComponent<MeshCollider>();
        //col.sharedMesh = mesh;
    }
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Target"))
        {
            //特殊处理，因为碰到的骨骼可能不一样
            if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelThreeIndex ||
                BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelFourIndex)
            {
                GameObject varObj = other.gameObject.GetComponent<TargetView>().parentTrans.gameObject;
                BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterRightClaw(varObj);
            }
            else
            {
                BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterRightClaw(other.gameObject);
            }
        }
    }
    private void OnTriggerExit(Collider other)
    {
        if (other.gameObject.CompareTag("Target"))
        {
            BattleCtrl.instance.levelManager.curLevel.chainRopeView.ExitRightClaw();
        }
    }
}
