Exemplo n.º 1
0
    void AttachTrack()
    {
        pointerData.GetComponent <RectTransform>().anchoredPosition = GetComponent <RectTransform>().anchoredPosition;
        boundTrack                 = pointerData.GetComponent <Image>();
        trackDisplay.material      = null;
        trackDisplay.raycastTarget = false;

        DragnDrop dnd = pointerData.GetComponent <DragnDrop>();

        if (dnd)
        {
            comboIndex = dnd.comboIndex;
        }

        UpdateTrackCombo();
        pointerData = null;
    }
Exemplo n.º 2
0
 private void OnMouseDown()
 {
     if (DataGame.coin > cost)
     {
         Debug.Log("Create Item");
         GameObject _item = (GameObject)Instantiate(item, transform.position, Quaternion.identity);
         foreach (Behaviour childCompnent in _item.GetComponentsInChildren <Behaviour>())
         {
             childCompnent.enabled = false;
         }
         screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
         offset      = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,
                                                                                                  Input.mousePosition.y, screenPoint.z));
         DragnDrop dd = _item.GetComponent <DragnDrop>();
         dd.enabled     = true;
         dd.screenPoint = screenPoint;
         dd.offset      = offset;
         dd.cost        = cost;
     }
     else
     {
     }
 }