Esempio n. 1
0
    public void Build()
    {
        int temp = 0;

        foreach (GameObject obj in pack)
        {
            ObjectInterface img = imgarr[temp].GetComponent <ObjectInterface>();
            img.ApplyItem(obj);
            temp++;
        }
    }
Esempio n. 2
0
    public void doWork()
    {
        if (hitInfo.collider == null && triggeredItem == null)
        {
            targetPosition   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            targetPosition.y = transform.position.y;
        }
        else if (hitInfo.collider != null && triggeredItem == null)
        {
            if (hitInfo.collider.tag == "Untagged" || hitInfo.collider.tag == "Floor")
            {
                targetPosition   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                targetPosition.y = transform.position.y;
            }
            else
            {
                Debug.Log("Hellor");

                ObjectInterface obj = hitInfo.collider.gameObject.GetComponent <ObjectInterface>();
                obj.Work();
            }
        }
        else if (hitInfo.collider == null && triggeredItem != null)
        {
            triggeredItem = null;
        }
        else if (hitInfo.collider != null && triggeredItem != null)
        {
            if (hitInfo.collider.tag == "Untagged" || hitInfo.collider.tag == "Floor")
            {
                triggeredItem = null;
            }
            else
            {
                ObjectInterface obj = hitInfo.collider.gameObject.GetComponent <ObjectInterface>();
                obj.ApplyItem(triggeredItem);
                triggeredItem = null;
            }
        }
        else
        {
            Debug.Log("Error");
        }
    }