コード例 #1
0
 public void OnTriggerStay(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         GetItem.Get(this.gameObject);
     }
 }
コード例 #2
0
    private void InteractionAction()
    {
        Ray ray = new Ray(transform.position, transform.forward);

        if (Physics.Raycast(ray, 2.0f, 1 << LayerMask.NameToLayer("Item")))
        {
            _getItem.Get();
        }
        else if (Physics.Raycast(ray, 2.0f, 1 << LayerMask.NameToLayer("ItemBox")))
        {
            _getItem.OpenBox();
        }
        else if (Physics.Raycast(ray, 2.0f, 1 << LayerMask.NameToLayer("StartPoint")) ||
                 Physics.Raycast(ray, 2.0f, 1 << LayerMask.NameToLayer("EndPoint")))
        {
            TransferMapMng.Instance.Open();
        }
    }