예제 #1
0
 public static void takeObject(GameObject selectedObject, GameObject objectPicked, string slotImage)
 {
     if (!SelectionSlotManager.isFull())
     {
         if (checkFreePosition() >= 0)
         {
             int appPos = checkFreePosition();
             takedObjects[appPos] = new TakedObject(selectedObject, objectPicked, slotImage);
             ((ControllerObject)takedObjects[appPos].getObjectTaked().GetComponent <ControllerObject>()).setPositionInObjectList(appPos);
         }
         else
         {
             takedObjects.Add(new TakedObject(selectedObject, objectPicked, slotImage));
             ((ControllerObject)takedObjects[takedObjects.Count - 1].getObjectTaked().GetComponent <ControllerObject>()).setPositionInObjectList(takedObjects.Count - 1);
         }
     }
 }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        var        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 1) && !SelectionSlotManager.isFull())
        {
            selection    = hit.transform;
            prefabParent = getPrefabsParent(selection.gameObject);
            if (prefabParent != null && SearchTag.search("spo", prefabParent))
            {
                keyIndicator.text = "PREMERE [E] PER RACCOGLIERE  2";

                if (Input.GetButtonDown("Fire1"))
                {
                    Debug.Log(((Tag)prefabParent.GetComponent <Tag>()).getTag());
                    Debug.Log("ha il tag");
                    ((SpawnableObject)prefabParent.GetComponent <SpawnableObject>()).setEnable(true);
                    keyIndicator.text = " ";
                }
            }
        }
    }