using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.UI;


public class goods : MonoBehaviour

{

   // Start is called before the first frame update

   void Start()

   {


   }


   // Update is called once per frame

   void Update()

   {

       Ray myRay = Camera.main.ScreenPointToRay(Input.mousePosition);

       RaycastHit myHit;

       if (Physics.Raycast(myRay, out myHit))

       {

           if (Input.GetMouseButtonDown(0))

           {

               if (myHit.collider.gameObject.tag == "goods")

               {

                   Destroy(GameObject.FindWithTag("goods"));

                   print("物體消失");

               }

               if (myHit.collider.gameObject.tag == "goods2")

               {

                   Destroy(GameObject.FindWithTag("goods2"));

                   print("物體消失");

               }

           }

       }

   }

}