Ejemplo n.º 1
0
    public void DropEvent()
    {
        Debug.Log("주사위 드랍");


        // 주사위를 쥐고있지 않을 경우 스킵한다
        if (bcm.GetDragDice() != null)
        {
            bcm.SetDragDice(null);

            // 드랍된 위치 체크. 전투슬롯의 위치인가?
            List <RaycastResult> results = new List <RaycastResult>();
            PointerEventData     ped     = new PointerEventData(null);
            ped.position = Input.mousePosition;

            graphicRaycaster.Raycast(ped, results);

            for (int i = 0; i < results.Count; i++)
            {
                BattleSlot bs = results[i].gameObject.GetComponent <BattleSlot>();
                if (bs)
                {
                    // 적쪽에 못올라가도록
                    if (bs.transform.parent.name == "EnemyZone")
                    {
                        break;
                    }

                    bcm.ResetDiceSlot();

                    // 전투 슬롯에 주사위 설정
                    bs.SetDice(this);

                    isOnBattleSlot = true;


                    // 타겟팅 시스템 설정
                    TargettingManager tm = FindObjectOfType <TargettingManager>();
                    if (tm)
                    {
                        bs.GetCurrentCommand().SetCaster(bs.gameObject);
                        tm.CreateTargetWindow(bs.GetCurrentCommand());
                    }



                    return;
                }
            }
        }

        //transform.position = defPos;
        bcm.ResetDiceSlot();
        bcm.SetDiceZone(this); // 주사위 존으로 되돌린다
        bcm.SetDragDice(null);
        isOnBattleSlot = false;
    }