示例#1
0
        public HexagonalCell GetEmptyCellFromNearVector(Vector3 _pos)
        {
            float         distanceMin = 999;
            HexagonalCell cellNear    = null;

            for (int y = 0; y < GlobalInfo.column; y++)
            {
                for (int x = 0; x < GlobalInfo.row; x++)
                {
                    HexagonalCell _cell = GetCell(x, y);
                    if (_cell != null && !_cell.GetIsFull())
                    {
                        float distanceCurrent = Vector3.Distance(_cell.transform.position, _pos);
                        if (distanceMin > distanceCurrent)
                        {
                            distanceMin = distanceCurrent;
                            cellNear    = _cell;
                            if (distanceMin < 20)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            return(cellNear);
        }
示例#2
0
        public HexagonalCell[] GetAllClosedCard()
        {
            List <HexagonalCell> allClosed = new List <HexagonalCell> ();

            for (int y = 0; y < GlobalInfo.column; y++)
            {
                for (int x = 0; x < GlobalInfo.row; x++)
                {
                    HexagonalCell _cell = GetCell(x, y);
                    if (_cell != null)
                    {
                        _cell.SetFlashingBack(false);
                        if (_cell.GetIsFull() && _cell.GetCard().GetIsClosed())
                        {
                            allClosed.Add(_cell);
                        }
                    }
                }
            }
            return(allClosed.ToArray());
        }