コード例 #1
0
 void OnTriggerStay2D(Collider2D other)
 {
     // 随从与玩家
     if (other.gameObject.CompareTag("Item"))
     {
         if ((other.transform.position - transform.position).sqrMagnitude < 1)
         {
             ItemBase item = other.GetComponent <ItemBase>();
             item.Activate(this);
         }
     }
 }