using FOHEART_Mocap;
using UnityEngine;

public class CollideToSetGrableFlag : MonoBehaviour
{
    [Tooltip("ƶ")]
    public FoheartGloveH1Pose gloveMainComponent = null;

    /// <summary>
    /// ǰGameObjectǷ
    /// </summary>
    private bool isLeftHand = false;

    private void Start()
    {
        isLeftHand = (gameObject.tag + "").Contains("LeftHand");
    }

    private void OnCollisionEnter(Collision other)
    {
        bind(other.gameObject);
    }

    private void OnTriggerStay(Collider other)
    {
        bind(other.gameObject);
    }

    private void OnCollisionStay(Collision other)
    {
        bind(other.gameObject);
    }

    private void OnTriggerEnter(Collider other)
    {
        bind(other.gameObject);
    }

    /// <summary>
    /// 趨  
    /// </summary>
    /// <param name="obj"></param>
    private void bind(GameObject obj)
    {
        gloveMainComponent.setAdjacentItem(obj, isLeftHand);
    }
}
