Esempio n. 1
0
    public void OnPointerClick(PointerEventData eventData)
    {
        GameObject pressGO = eventData.pointerEnter;

        if (_dicGO2Ctrl.ContainsKey(pressGO))
        {
            //DrawLine(_dicGO2Ctrl[pressGO].pos);
            GridCellCtrl ctrl = _dicGO2Ctrl[pressGO];
            _start = ctrl.pos;
            ClearLine();
            ctrl.SetColor(Color.red);
        }
    }
Esempio n. 2
0
    void DrawLine(Vector2Int end)
    {
        ClearLine();

        _dicPos2Ctrl[_start].SetColor(Color.red);

        GridCellCtrl ctrl = _dicPos2Ctrl[end];

        ctrl.SetColor(Color.green);

        List <Vector2Int> touchedGrids = GridHelper.GetTouchedPosBetweenTwoPoints(_start, ctrl.pos);

        for (int i = 0; i < touchedGrids.Count; i++)
        {
            _dicPos2Ctrl[touchedGrids[i]].SetColor(Color.black);
        }
    }