コード例 #1
0
ファイル: UIGrid.cs プロジェクト: Kwakwaouaite/DungeonAdvisor
    void AddDoors()
    {
        // add up
        UICell cellU = InstantiateCell(5, m_RoomConfig.GetUp(), UIItem.eType.Door);
        UIItem doorU = Instantiate <UIItem>(m_RoomConfig.GetDoor(RoomConfig.eDir.UP), cellU.transform);

        cellU.AddItem(doorU);

        // add left
        UICell cellL = InstantiateCell(m_RoomConfig.GetLeft(), 5, UIItem.eType.Door);
        UIItem doorL = Instantiate <UIItem>(m_RoomConfig.GetDoor(RoomConfig.eDir.LEFT), cellL.transform);

        cellL.AddItem(doorL);

        // add bottom
        UICell cellB = InstantiateCell(5, m_RoomConfig.GetDown(), UIItem.eType.Door);
        UIItem doorB = Instantiate <UIItem>(m_RoomConfig.GetDoor(RoomConfig.eDir.DOWN), cellB.transform);

        cellB.AddItem(doorB);

        // add right
        UICell cellR = InstantiateCell(m_RoomConfig.GetRight(), 5, UIItem.eType.Door);
        UIItem doorR = Instantiate <UIItem>(m_RoomConfig.GetDoor(RoomConfig.eDir.RIGHT), cellR.transform);

        cellR.AddItem(doorR);
    }
コード例 #2
0
ファイル: UIDrag.cs プロジェクト: Kwakwaouaite/DungeonAdvisor
    private void OnMouseUp()
    {
        m_Dragging = false;

        if (GameManager.CanAddItems())
        {
            UICell activeCell = GameManager.GetActiveCell();

            if (activeCell && isCellValid(activeCell))
            {
                UIItem item = Instantiate <UIItem>(m_Item, activeCell.transform);
                activeCell.AddItem(item);
                m_DragOffset = Vector3.zero;

                m_Item.Buy();
            }
        }
        m_SnapToPos = false;
    }