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

public class LeftClawTrigger : 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.EnterLeftClaw(varObj);
            }
            else
            {
                BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterLeftClaw(other.gameObject);
            }
        }
    }
    private void OnTriggerExit(Collider other)
    {
        if (other.gameObject.CompareTag("Target"))
        {
            BattleCtrl.instance.levelManager.curLevel.chainRopeView.ExitLeftClaw();
        }
    }
}
