void OnMouseUp()
 {
     if (dragging)
     {
         dragging = false;
         da.OnEndDrag();
     }
 }
 void OnMouseUp()
 {
     if (dragging)
     {
         dragging = false;
         dragginAction?.OnEndDrag();
     }
 }
示例#3
0
 void OnMouseUp()
 {
     if (dragging)
     {
         dragging = false;
         HoverPreview.PreviewsAllowed = true;   // NEW LINE
         da.OnEndDrag();
     }
 }
示例#4
0
 private void OnMouseUp()
 {
     if (dragging)
     {
         dragging = false;
         HoverPreview.PreviewsAllowed = true;
         da.OnEndDrag();
     }
 }
 void OnMouseUp()
 {
     Debug.Log("OnMouseUp");
     if (dragging)
     {
         dragging = false;
         //HoverPreview.PreviewsAllowed = true;   // NEW LINE
         da.OnEndDrag();
     }
 }
示例#6
0
    void OnMouseUp()
    {
        //check col gameobject
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        RaycastHit[] hits = Physics.RaycastAll(ray);
        for (int i = 0; i < hits.Length; i++)
        {
            Debug.Log(hits[i].collider.name);
            if (hits[i].collider.tag == "CombineCard")
            {
                colObj  = hits[i].collider.gameObject;
                coltype = 3;
                break;
            }
            if (hits[i].collider.tag == "Monster")
            {
                colObj  = hits[i].collider.gameObject;
                coltype = 1;
                break;
            }
            if (hits[i].collider.tag == "Player")
            {
                colObj  = hits[i].collider.gameObject;
                coltype = 2;
                break;
            }
        }


        //if is combinecard
        if (coltype == 3)
        {
            ElementCardInstance card = this.GetComponent <ElementCardUIController>().GetCardInstance();

            //at the combineCard position instantiate this card
            Vector3 pos = new Vector3();


            if (colObj.name == "CombineCardRight")
            {
                if (GameObject.Find("CombineCardRight").transform.childCount > 0)
                {
                    ElementCardInstance tempInstance = GameObject.Find("CombineCardRight").transform.GetChild(0).GetComponent <ElementCardUIController>().GetCardInstance();
                    DataManager.Instance.BattleContext.Player.HandheldSet.AddItem(tempInstance);
                    Destroy(GameObject.Find("CombineCardRight").transform.GetChild(0).gameObject);
                }
                pos = CobineRightPos;
                OnItemCard(card, pos);
            }
            else
            {
                if (GameObject.Find("CombineCardLeft").transform.childCount > 0)
                {
                    ElementCardInstance tempInstance = GameObject.Find("CombineCardLeft").transform.GetChild(0).GetComponent <ElementCardUIController>().GetCardInstance();
                    DataManager.Instance.BattleContext.Player.HandheldSet.AddItem(tempInstance);
                    Destroy(GameObject.Find("CombineCardLeft").transform.GetChild(0).gameObject);
                }
                pos = CobineLeftPos;
                OnItemCard(card, pos);
            }
        }

        //if is player or monster, play effect
        if (coltype < 3 && PlayerPrefs.GetInt("ComboCardPanelState") != 1)
        {
            ElementCardPlayEvent playEvent = new ElementCardPlayEvent();
            playEvent.Card = this.GetComponent <ElementCardUIController>().GetCardInstance();
            Actor[] targetList = new Actor[1];
            if (colObj.tag == "Monster")
            {
                targetList[0] = colObj.GetComponent <MonsterUIController>().EnemyInstance;
            }
            if (colObj.tag == "Player")
            {
                targetList[0] = colObj.GetComponent <PlayerUIController>().PlayerInstance;
            }
            playEvent.Targets = targetList;
            EventManager.TriggerEvent(BattleManager.PLAY_ELEMENT_CARD, playEvent);
        }


        if (dragging)
        {
            dragging = false;
            HoverPreview.PreviewsAllowed = true;
            colObj  = null;
            coltype = 99;
            da.OnEndDrag();
        }
    }