Exemple #1
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        Debug.Log("On Begin Drag");
        if (this.transform.parent.name != "Gears")
        {
            Debug.Log("Doesn't belong to the field");
            proceed = false;
            return;
        }
        Debug.Log(this.transform.parent.name);

        parentToReturnTo = gearPanel.transform;
        //siblingIndex = this.transform.GetSiblingIndex();
        GetComponent<CanvasGroup>().blocksRaycasts = false;

        // Create a gear to replace the one that was just picked up
        newGear = GameObject.Instantiate(gearPrefab, this.transform.position, Quaternion.identity) as Gear;
        newGear.GetComponent<CanvasGroup>().alpha = 0;
        newGear.transform.SetParent(parentToReturnTo);
        newGear.GetComponent<CanvasGroup>().alpha = 1;
    }