Ejemplo n.º 1
0
    public void SpawnDraggable()
    {
        if (!Instantiated)
        {
            Debug.Log("Trying to Spawn");

            // Only Execute Code if a draggable image isn't currently active
            Instantiated = true;

            GameObject draggable = Instantiate(DraggableImage, Input.mousePosition, Quaternion.identity);

            draggable.transform.parent = this.transform.parent.transform;

            //Scale the object once made
            draggable.transform.localScale = new Vector3(1, 1, 1);
            //if(draggable.name == "DraggableUrbanTemplate")
            //{
            //    draggable. = GameObject.Find("DraggableUrbanTemplate").transform.localScale;

            //}

            //if (draggable.name == "DraggableRuralTemplate")
            //{
            //    draggable.transform.localScale = GameObject.Find("DraggableRuralTemplate").transform.localScale;

            //}

            //if (draggable.name == "DraggableSuburbanTemplate")
            //{
            //    draggable.transform.localScale = GameObject.Find("DraggableSuburbanTemplate").transform.localScale;

            //}

            // Set the Image manager to the Script attached to the draggable image
            ImageManager = draggable.gameObject.GetComponent <DraggableImg>();

            // MAY NOT NEED originalPos = Input.mousePosition;
        }

        //locked = ImageManager.locked;

        //if (!locked)
        //{


        //    DraggableImage.transform.position = Input.mousePosition;

        //}
    }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     ImageManager = GameObject.FindGameObjectWithTag("DraggableImage").GetComponent <DraggableImg>();
 }