Beispiel #1
0
    public void OverCase(CellsBehaviour cell, bool hover)
    {
        if (hover)
        {
            posOfCursors.ActiveAllChild(false);

            //Debug.Log("change scale");
            cursors[indexCursor].obj.transform.SetParent(cell.GetParentCell());
            cursors[indexCursor].obj.GetComponent <RectTransform>().ResetPos();
            cursors[indexCursor].obj.GetComponent <RectTransform>().ResetScale();
            cursors[indexCursor].obj.SetActive(true);
        }
        else
        {
            cursors[indexCursor].obj.SetActive(false);
            cursors[indexCursor].obj.transform.SetParent(posOfCursors);
        }
    }
Beispiel #2
0
    /// <summary>
    /// called when we want to add something to a cell
    /// (add a image on top of a cell)
    /// </summary>
    private void AddToCell(int x, int y, ushort id, bool duplicate = true)
    {
        CellsBehaviour _cell = GridManager.Instance.GetCell(x, y);

        if (!duplicate && _cell.OtherWithSameId(id))
        {
            return;
        }

        /*
         * InsideCell inside = new InsideCell
         * {
         *  cell = _cell.transform,
         *  posCell = new Point(x, y),
         * };
         * insideCellList.Add(inside);
         */

        GameObject newCell = Instantiate(prefabsCellInside, Vector3.zero, Quaternion.identity, _cell.GetParentCell());

        newCell.GetComponent <RectTransform>().ResetPos();
        newCell.GetComponent <RectTransform>().ResetScale();
        newCell.SetActive(true);

        _cell.AddToCell(newCell, x, y, id);
    }