コード例 #1
0
 private void UseEquippedWTool()
 {
     if (Input.GetMouseButtonDown(0) && inventory.hasEquipped)
     {
         RaycastHit hitTool;
         Ray        highlightRay = new Ray(cam.transform.position, cam.transform.forward);
         Debug.DrawRay(cam.transform.position, cam.transform.forward * 30);
         Physics.Raycast(highlightRay, out hitTool, 30);
         if (inventory.GetEquipped().GetComponent <IWeaponTool>().Use(hitTool))
         {
             inventory.DelEquipped();
         }
         Debug.Log($"Uses equipped {inventory.GetEquipped()?.name}");
     }
 }