public void SimulatedMove()
    {
        hypoteticalPosition = hypoteticalBestMove;
        hypoteticalPosition.hypoteticalPieceOnTop = this;

        // update hypotetical possible moves
    }
Esempio n. 2
0
    private void AddShapeToAllSlots()
    {
        if (this.board == null || (Object)this.ShapeSpawner == (Object)null)
        {
            return;
        }
        BoardSlot[, ,] boardSlotArray = this.board.TheGameBoard;
        int length1 = boardSlotArray.GetLength(0);
        int length2 = boardSlotArray.GetLength(1);
        int length3 = boardSlotArray.GetLength(2);

        for (int index1 = 0; index1 < length1; ++index1)
        {
            for (int index2 = 0; index2 < length2; ++index2)
            {
                for (int index3 = 0; index3 < length3; ++index3)
                {
                    BoardSlot  boardSlot = boardSlotArray[index1, index2, index3];
                    Vector3    zero      = Vector3.zero;
                    Quaternion identity  = Quaternion.identity;
                    this.GetLayoutStuff(boardSlot, ref zero, ref identity);
                    GameObject gameObject = Object.Instantiate((Object)this.ShapeSpawner, zero, identity) as GameObject;
                    this.BoardSlotToVisualMap.Add(boardSlot, gameObject);
                }
            }
        }
    }
        public void UpdateBoardSlot(BoardSlot boardSlot, BoardSlotChangeOrigin origin)
        {
            BoardBlock bBlock = GetBoardBlock(boardSlot.GetPosition());

            if (boardSlot.IsEmpty())
            {
                bBlock.BlockColor     = "";
                bBlock.BlockTextColor = "";
                bBlock.BlockValue     = "";
            }
            else
            {
                Block block = boardSlot.GetBlock();

                if (origin == BoardSlotChangeOrigin.Spawned)
                {
                    ScaleHelper.ScaleIn(bBlock);
                }
                else if (origin == BoardSlotChangeOrigin.MergedInto)
                {
                    ScaleHelper.Pulse(bBlock);
                }

                bBlock.BlockColor     = ColorTranslator.ToHtml(block.BackgroundColor);
                bBlock.BlockTextColor = ColorTranslator.ToHtml(block.Color);
                bBlock.BlockValue     = block.Value.ToString();
            }
        }
Esempio n. 4
0
    public BoardSlot[,] BuildBoard(int p_size, Action <int, int> p_callback)
    {
        BoardSlot[,] result = new BoardSlot[p_size, p_size];

        Rect gamePanelRect = RectTransformUtility.PixelAdjustRect(_gamePanelRT, _gameCanvas);

        float panelWidth  = gamePanelRect.width;
        float panelHeight = gamePanelRect.height;

        _gamePanelGridLayout.cellSize = new Vector2(panelWidth / p_size, panelHeight / p_size);

        for (int i = 0; i < p_size; i++)
        {
            for (int j = 0; j < p_size; j++)
            {
                BoardSlot newSlot = Instantiate(SlotPrefab);
                newSlot.Init(new Vector2Int(i, j), p_callback);
                newSlot.transform.SetParent(GamePanel.transform, false);
                newSlot.gameObject.SetActive(true);

                result[i, j] = newSlot;
            }
        }

        return(result);
    }
Esempio n. 5
0
 public void removeUnitAt(int x, int y)
 {
     if (x >= 0 && y >= 0 && x < boardWidth && y < boardHeight)
     {
         BoardSlot bs = getSlot(new Vector2Int(x, y));
         bs.unit = null;
     }
 }
Esempio n. 6
0
 void OnMouseDown()
 {
     if (currentslot != null && !completed)
     {
         currentslot.free = true;
         currentslot      = null;
     }
 }
 public void SetupDirectNeighborPointers()
 {
     this.xUpBoardSlot   = this.ParentGameBoard.GetBoardSlotForPositionOffset(this, BoardSlot.xUpBoardPos, false, false, false, false);
     this.xDownBoardSlot = this.ParentGameBoard.GetBoardSlotForPositionOffset(this, BoardSlot.xDownBoardPos, false, false, false, false);
     this.yUpBoardSlot   = this.ParentGameBoard.GetBoardSlotForPositionOffset(this, BoardSlot.yUpBoardPos, false, false, false, false);
     this.yDownBoardSlot = this.ParentGameBoard.GetBoardSlotForPositionOffset(this, BoardSlot.yDownBoardPos, false, false, false, false);
     this.zUpBoardSlot   = this.ParentGameBoard.GetBoardSlotForPositionOffset(this, BoardSlot.zUpBoardPos, false, false, false, false);
     this.zDownBoardSlot = this.ParentGameBoard.GetBoardSlotForPositionOffset(this, BoardSlot.zDownBoardPos, false, false, false, false);
 }
Esempio n. 8
0
    private void OnEnable()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity))
        {
            highlightedSlot = hit.collider.GetComponent <BoardSlot>();
            highlightedSlot.Highlight(true);
        }
    }
Esempio n. 9
0
    private void DeformMeshToCoverBoardSlot(BoardSlot slot, GameObject MeshGO)
    {
        if ((UnityEngine.Object)BaseMesh == (UnityEngine.Object)null)
        {
            BaseMesh      = ShapeSpawner.GetComponent <MeshFilter>().mesh;
            BaseMeshVerts = BaseMesh.vertices;
        }
        int VisualX;
        int VisualY;
        int VisualZ;

        GetVisualPositionsForBoardSlot(slot, out VisualX, out VisualY, out VisualZ);
        int keyForY1 = GetKeyForY(VisualY, VisualZ);

        if (vertlists.ContainsKey(keyForY1))
        {
            Mesh mesh = MeshGO.GetComponent <MeshFilter>().mesh;
            SphericalLayoutTest.VerticesInfo verticesInfo = vertlists[keyForY1];
            mesh.vertices = verticesInfo.verts;
            mesh.normals  = verticesInfo.normals;
        }
        else
        {
            float AzimuthToCenterDeg;
            float SlotAzimuthBreadthDeg;
            float ElevationToCenterDeg;
            float SlotElevationBreadthDeg;
            float SlotCenterRadius;
            GetSlotSphericalInfo(VisualX, VisualY, VisualZ, out AzimuthToCenterDeg, out SlotAzimuthBreadthDeg, out ElevationToCenterDeg, out SlotElevationBreadthDeg, out SlotCenterRadius);
            Mesh      mesh         = MeshGO.GetComponent <MeshFilter>().mesh;
            Vector3[] vector3Array = new Vector3[mesh.vertexCount];
            Transform transform    = MeshGO.transform;
            Vector3   localScale   = transform.localScale;
            for (int index = 0; index < vector3Array.Length; ++index)
            {
                Vector3 vector3   = BaseMeshVerts[index];
                float   polar     = (AzimuthToCenterDeg + vector3.x * SlotAzimuthBreadthDeg) * (float)(Math.PI / 180.0);
                float   elevation = (ElevationToCenterDeg + vector3.y * SlotElevationBreadthDeg) * (float)(Math.PI / 180.0);
                Vector3 outCart;
                SphericalCoordinates.SphericalToCartesian(SlotCenterRadius - localScale.z * vector3.z, polar, elevation, out outCart);
                outCart             = transform.InverseTransformPoint(outCart);
                vector3Array[index] = outCart;
            }
            mesh.vertices = vector3Array;
            mesh.RecalculateNormals();
            int keyForY2 = GetKeyForY(VisualY, VisualZ);
            if (vertlists.ContainsKey(keyForY2))
            {
                return;
            }
            vertlists[keyForY2]         = new SphericalLayoutTest.VerticesInfo();
            vertlists[keyForY2].verts   = vector3Array;
            vertlists[keyForY2].normals = mesh.normals;
        }
    }
Esempio n. 10
0
    //public virtual T GetGameShapeProxyAtScreenPosition<T>(Vector3 inScreenPosition) where T : GameShapeProxyBase
    //{
    //    T obj = (T)null;
    //    if ((Object)this.ViewingCamera != (Object)null)
    //    {
    //        RaycastHit hitInfo;
    //        if (Physics.Raycast(this.ViewingCamera.ScreenPointToRay(inScreenPosition), out hitInfo, 1000f))
    //        {
    //            GameObject gameObject = hitInfo.collider.gameObject;
    //            T gameShapeProxy = this.FindGameShapeProxy<T>(gameObject);
    //            object[] objArray = new object[5];
    //            int index1 = 0;
    //            string str1 = "Hit (";
    //            objArray[index1] = (object)str1;
    //            int index2 = 1;
    //            string name = gameObject.name;
    //            objArray[index2] = (object)name;
    //            int index3 = 2;
    //            string str2 = ") with parent shapeproxy (";
    //            objArray[index3] = (object)str2;
    //            int index4 = 3;
    //            // ISSUE: variable of a boxed type
    //            __Boxed<T> local = (object)gameShapeProxy;
    //            objArray[index4] = (object)local;
    //            int index5 = 4;
    //            string str3 = ")";
    //            objArray[index5] = (object)str3;
    //            Debug.Log((object)string.Concat(objArray));
    //            obj = gameShapeProxy;
    //        }
    //        else
    //            obj = (T)null;
    //    }
    //    return obj;
    //}

    //protected T FindGameShapeProxy<T>(GameObject inGO) where T : GameShapeProxyBase
    //{
    //    T obj = (T)null;
    //    return GameObjectHelpers.FindParentGameObjectComponent<T>(inGO);
    //}

    public bool GetCameraPositionForBoardSlot(BoardSlot slot, ref Vector3 result)
    {
        bool flag = false;

        result = Vector3.zero;
        if (slot != null)
        {
            flag = this.GetCameraPositionForBoardPosition(slot.BoardPos, ref result);
        }
        return(flag);
    }
Esempio n. 11
0
 public void GetOccupiedSlotsCopy(List <BoardSlot> inOccupiedSlots)
 {
     for (int index = 0; index < this.OccupiedSlots.Count; ++index)
     {
         BoardSlot boardSlot = this.OccupiedSlots[index];
         if (boardSlot != null && !inOccupiedSlots.Contains(boardSlot))
         {
             inOccupiedSlots.Add(boardSlot);
         }
     }
 }
Esempio n. 12
0
 public BoardSlot getSlot(Vector2Int location)
 {
     if (location.x >= 0 && location.y >= 0 && location.x < boardWidth && location.y < boardHeight)
     {
         BoardSlot bs = _slots[location.x, location.y];
         return(bs);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 13
0
 public BaseUnit getPieceAtLoc(int x, int y)
 {
     if (x >= 0 && y >= 0 && x < boardWidth && y < boardHeight)
     {
         BoardSlot bs = _slots[x, y];
         return(bs.unit);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 14
0
    /*
     * The initBoardSpace() function is used to internally build the array
     * of board slots used to virtualize the game board
     *
     * This should be called first thing before any interactions with the board take place,
     * if the board is resized post game start for some reason this should also be re-ran
     *
     */
    private void _initBoardSpace()
    {
        Debug.Log("Initialized size " + boardWidth + ", " + boardHeight);
        _slots = new BoardSlot[boardWidth, boardHeight];

        for (int _x = 0; _x < boardWidth; _x++)
        {
            for (int _y = 0; _y < boardHeight; _y++)
            {
                _slots[_x, _y] = new BoardSlot(_x, _y);
            }
        }
    }
Esempio n. 15
0
    public void Move(BoardSlot newPos)
    {
        if (position != null)
        {
            position.pieceOnTop = null;
        }

        position            = newPos;
        position.pieceOnTop = this;
        transform.position  = new Vector3(newPos.transform.position.x, newPos.transform.position.y, transform.position.z);
        // update possible moves

        // change turn
    }
Esempio n. 16
0
    public void GetLayoutStuff(BoardSlot slot, ref Vector3 newPosition, ref Quaternion FacingDirection)
    {
        BoardPosition boardPos = slot.BoardPos;
        float         num1     = 360f / (float)this.board.BoardXSize;
        BoardPosition pos      = boardPos;

        this.board.CreateSafeBoardPosition(ref pos);
        Quaternion quaternion = Quaternion.Euler(0.0f, this.ForwardAngle + (float)pos.X * num1, 0.0f);
        float      num2       = this.BaseDistFromCenterAxis + this.GetCylinderDepthOffset(slot);

        newPosition     = quaternion * Vector3.forward * num2;
        newPosition.y   = this.GetCylinderPositionY(slot);
        FacingDirection = quaternion;
    }
Esempio n. 17
0
    private GameShape GetShapeInBoardSlotAtOffset(BoardPosition offset)
    {
        GameShape     gameShape = (GameShape)null;
        BoardPosition pos       = BoardPosition.AddBoardPositions(this.boardPos, offset);

        if (this.ParentGameBoard.CreateSafeBoardPosition(ref pos))
        {
            BoardSlot boardSlotForPosition = this.ParentGameBoard.GetBoardSlotForPosition(pos);
            if (boardSlotForPosition != null)
            {
                gameShape = boardSlotForPosition.FilledShape;
            }
        }
        return(gameShape);
    }
Esempio n. 18
0
    private GameShape GetShapeInBoardSlotAtOffset(BoardPosition offset, bool bIgnoreSameFilledShape)
    {
        GameShape     gameShape = (GameShape)null;
        BoardPosition pos       = BoardPosition.AddBoardPositions(this.boardPos, offset);

        if (this.ParentGameBoard.CreateSafeBoardPosition(ref pos))
        {
            BoardSlot boardSlotForPosition = this.ParentGameBoard.GetBoardSlotForPosition(pos);
            if (boardSlotForPosition != null && boardSlotForPosition.HasFilledShape() && (!bIgnoreSameFilledShape || bIgnoreSameFilledShape && boardSlotForPosition.FilledShape != this.FilledShape))
            {
                gameShape = boardSlotForPosition.FilledShape;
            }
        }
        return(gameShape);
    }
Esempio n. 19
0
    private void CacheSphericalProxyInfo(BoardSlot slot, BoardSlotSphericalProxy slotproxy)
    {
        int VisualX;
        int VisualY;
        int VisualZ;

        GetVisualPositionsForBoardSlot(slot, out VisualX, out VisualY, out VisualZ);
        float AzimuthToCenterDeg;
        float SlotAzimuthBreadthDeg;
        float ElevationToCenterDeg;
        float SlotElevationBreadthDeg;
        float SlotCenterRadius;

        GetSlotSphericalInfo(VisualX, VisualY, VisualZ, out AzimuthToCenterDeg, out SlotAzimuthBreadthDeg, out ElevationToCenterDeg, out SlotElevationBreadthDeg, out SlotCenterRadius);
        slotproxy.SetSphericalPositions(AzimuthToCenterDeg, SlotAzimuthBreadthDeg, ElevationToCenterDeg, SlotElevationBreadthDeg);
    }
Esempio n. 20
0
    /// <summary>
    /// If the piece altitude is above PIECES_Y_OUT after CHECK_ALTITUDE_TIME, it is destroyed, an explosion is instantiated and the score is decreased
    /// </summary>
    /// <param name="bs"></param>
    /// <returns></returns>
    IEnumerator checkAltitude(BoardSlot bs)
    {
        Rigidbody rb            = bs.Piece.GetComponent <Rigidbody>();
        Vector3   piecePosition = bs.Piece.transform.position;

        yield return(new WaitForSeconds(Globals.CHECK_ALTITUDE_TIME));

        if (rb.transform.position.y > Globals.PIECES_Y_OUT)
        {
            explosionInstantiate(bs.OccupiedbyPlayer, piecePosition.x, piecePosition.y, piecePosition.z);
            incrementScore(bs.OccupiedbyPlayer, -1);
            bs.OccupiedbyPlayer = Globals.EMPTY;
            Destroy(bs.Piece);
        }
        yield return(null);
    }
Esempio n. 21
0
    public void GetLayoutStuff(BoardSlot slot, ref Vector3 newPosition, ref Quaternion FacingDirection)
    {
        int VisualX;
        int VisualY;
        int VisualZ;

        GetVisualPositionsForBoardSlot(slot, out VisualX, out VisualY, out VisualZ);
        Vector3 pos;
        Vector3 norm;

        GetPositionAndNormalForSlotXAndY(VisualX, VisualY, VisualZ, out pos, out norm);
        Quaternion quaternion = Quaternion.LookRotation(norm, Vector3.up);

        newPosition     = pos;
        FacingDirection = quaternion;
    }
Esempio n. 22
0
    private float GetCylinderPositionY(BoardSlot slot)
    {
        float num1 = 2f;
        float num2;

        if (this.board.BoardYSize % 2 == 0)
        {
            int num3 = this.board.BoardYSize / 2;
            num2 = slot.BoardPos.Y >= num3 ? (float)((double)(slot.BoardPos.Y - num3) * (double)num1 + 0.5 * (double)num1) : (float)-((double)(num3 - 1 - slot.BoardPos.Y) * (double)num1 + 0.5 * (double)num1);
        }
        else
        {
            int num3 = this.board.BoardYSize / 2;
            num2 = slot.BoardPos.Y >= num3 ? (slot.BoardPos.Y <= num3 ? 0.0f : (float)(slot.BoardPos.Y - num3) * num1) : (float)-(double)(num3 - slot.BoardPos.Y) * num1;
        }
        return(num2);
    }
Esempio n. 23
0
        private static Word GetWordFromRow(int row, int startColumn)
        {
            List <BoardSlot> letterPositions = new List <BoardSlot>();

            var column = startColumn;

            while (column - 1 >= 0)
            {
                var boardSlot = Board.Board.Slots[row, column - 1];
                if (boardSlot.IsFilled || boardSlot.IsPending)
                {
                    column--;
                }
                else
                {
                    break;
                }
            }

            var       horizontalWordSB = new StringBuilder();
            int       points           = 0;
            BoardSlot currentBoardSlot = Board.Board.Slots[row, column];

            do
            {
                horizontalWordSB.Append(currentBoardSlot.CurrentLetter);
                points += currentBoardSlot.Points;
                letterPositions.Add(currentBoardSlot);

                column++;
                if (column == Board.Board.Columns)
                {
                    break;
                }

                currentBoardSlot = Board.Board.Slots[row, column];
            }while (currentBoardSlot.IsFilled || currentBoardSlot.IsPending);

            return(new Word
            {
                Text = horizontalWordSB.ToString().ToUpperInvariant(),
                Points = points,
                LetterPositions = letterPositions
            });
        }
Esempio n. 24
0
        private static Word GetWordFromColumn(int column, int startRow)
        {
            List <BoardSlot> letterPositions = new List <BoardSlot>();

            var row = startRow;

            while (row - 1 >= 0)
            {
                var boardSlot = Board.Board.Slots[row - 1, column];
                if (boardSlot.IsFilled || boardSlot.IsPending)
                {
                    row--;
                }
                else
                {
                    break;
                }
            }

            var       verticalWordSB   = new StringBuilder();
            int       points           = 0;
            BoardSlot currentBoardSlot = Board.Board.Slots[row, column];

            do
            {
                verticalWordSB.Append(currentBoardSlot.CurrentLetter);
                points += currentBoardSlot.Points;
                letterPositions.Add(currentBoardSlot);

                row++;
                if (row == Board.Board.Rows)
                {
                    break;
                }

                currentBoardSlot = Board.Board.Slots[row, column];
            }while (currentBoardSlot.IsFilled || currentBoardSlot.IsPending);

            return(new Word
            {
                Text = verticalWordSB.ToString().ToUpperInvariant(),
                Points = points,
                LetterPositions = letterPositions
            });
        }
        private bool MergeBlocks(BoardSlot from, BoardSlot to, bool onlySimulate)
        {
            if (from.GetBlock().Value == to.GetBlock().Value)
            {
                if (!onlySimulate)
                {
                    int newValue = from.GetBlock().Value * 2;
                    Board.ReplaceBlock(to, new Block(newValue));
                    Board.RemoveBlock(from);

                    Score.Add(newValue);
                }

                return(true);
            }

            return(false);
        }
Esempio n. 26
0
    public GameShape GetNeighborShapeInDirection(BoardPosition inDirection)
    {
        GameShape     gameShape = (GameShape)null;
        BoardPosition pos       = this.BoardPos + new BoardPosition()
        {
            X = Mathf.Clamp(inDirection.X, -1, 1),
            Y = Mathf.Clamp(inDirection.Y, -1, 1),
            Z = Mathf.Clamp(inDirection.Z, -1, 1)
        };

        if (this.ParentGameBoard.CreateSafeBoardPosition(ref pos))
        {
            BoardSlot boardSlotForPosition = this.ParentGameBoard.GetBoardSlotForPosition(pos);
            if (boardSlotForPosition != null)
            {
                gameShape = boardSlotForPosition.FilledShape;
            }
        }
        return(gameShape);
    }
Esempio n. 27
0
    public void GetNeighborShapes(Dictionary <GameShape, int> neighbors)
    {
        bool      bIgnoreSameFilledShape = true;
        GameShape other1 = this.xUpBoardSlot == null?this.GetShapeInBoardSlotAtOffset(BoardSlot.xUpBoardPos, bIgnoreSameFilledShape) : this.xUpBoardSlot.GetFilledShape();

        if (other1 != null)
        {
            BoardSlot.AddOrIncrementDictSet(neighbors, other1);
        }
        GameShape other2 = this.xDownBoardSlot == null?this.GetShapeInBoardSlotAtOffset(BoardSlot.xDownBoardPos, bIgnoreSameFilledShape) : this.xDownBoardSlot.GetFilledShape();

        if (other2 != null)
        {
            BoardSlot.AddOrIncrementDictSet(neighbors, other2);
        }
        GameShape other3 = this.yUpBoardSlot == null?this.GetShapeInBoardSlotAtOffset(BoardSlot.yUpBoardPos, bIgnoreSameFilledShape) : this.yUpBoardSlot.GetFilledShape();

        if (other3 != null)
        {
            BoardSlot.AddOrIncrementDictSet(neighbors, other3);
        }
        GameShape other4 = this.yDownBoardSlot == null?this.GetShapeInBoardSlotAtOffset(BoardSlot.yDownBoardPos, bIgnoreSameFilledShape) : this.yDownBoardSlot.GetFilledShape();

        if (other4 != null)
        {
            BoardSlot.AddOrIncrementDictSet(neighbors, other4);
        }
        GameShape other5 = this.zUpBoardSlot == null?this.GetShapeInBoardSlotAtOffset(BoardSlot.zUpBoardPos, bIgnoreSameFilledShape) : this.zUpBoardSlot.GetFilledShape();

        if (other5 != null)
        {
            BoardSlot.AddOrIncrementDictSet(neighbors, other5);
        }
        GameShape other6 = this.zDownBoardSlot == null?this.GetShapeInBoardSlotAtOffset(BoardSlot.zDownBoardPos, bIgnoreSameFilledShape) : this.zDownBoardSlot.GetFilledShape();

        if (other6 == null)
        {
            return;
        }
        BoardSlot.AddOrIncrementDictSet(neighbors, other6);
    }
Esempio n. 28
0
 private void UpdateSlotVisuals()
 {
     if (board == null || (UnityEngine.Object)ShapeSpawner == (UnityEngine.Object)null)
     {
         return;
     }
     using (Dictionary <BoardSlot, GameObject> .Enumerator enumerator = BoardSlotToVisualMap.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             KeyValuePair <BoardSlot, GameObject> current = enumerator.Current;
             Vector3    zero     = Vector3.zero;
             Quaternion identity = Quaternion.identity;
             BoardSlot  key      = current.Key;
             GameObject MeshGO   = current.Value;
             GetLayoutStuff(key, ref zero, ref identity);
             MeshGO.transform.position = zero;
             MeshGO.transform.rotation = identity;
             DeformMeshToCoverBoardSlot(key, MeshGO);
         }
     }
 }
Esempio n. 29
0
    public int GetVerticalScore(int firstId)
    {
        int score      = 0;
        int wordFactor = 1;

        for (int i = firstId; i < 225; i += 15)
        {
            BoardSlot boardSlot = BoardSlots[i].GetComponent <BoardSlot>();

            if (BoardSlots[i] && !boardSlot.free)
            {
                if (!boardSlot.completed)
                {
                    //score += Alphabet.data.GetLetterScore(BoardSlots[i].GetComponentInChildren<BoardTile>().letter) * (int)boardSlot.letterFactor;
                    score += BoardSlots[i].GetComponentInChildren <BoardTile>().score *(int)boardSlot.letterFactor;
                    if ((int)boardSlot.wordFactor > 1)
                    {
                        wordFactor *= (int)boardSlot.wordFactor;
                    }
                }
                else
                {
                    //score += Alphabet.data.GetLetterScore(BoardSlots[i].GetComponentInChildren<BoardTile>().letter);
                    score += BoardSlots[i].GetComponentInChildren <BoardTile>().score;
                }

                if (i + 15 > 224)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
        return(score * wordFactor);
    }
Esempio n. 30
0
    private void AddShapeToAllSlots()
    {
        if (board == null || (UnityEngine.Object)ShapeSpawner == (UnityEngine.Object)null)
        {
            return;
        }
        BoardSlot[, ,] boardSlotArray = board.TheGameBoard;
        int length1 = boardSlotArray.GetLength(0);
        int length2 = boardSlotArray.GetLength(1);
        int length3 = boardSlotArray.GetLength(2);

        for (int index1 = 0; index1 < length1; ++index1)
        {
            for (int index2 = 0; index2 < length2; ++index2)
            {
                for (int index3 = 0; index3 < length3; ++index3)
                {
                    BoardSlot  boardSlot = boardSlotArray[index1, index2, index3];
                    Vector3    zero      = Vector3.zero;
                    Quaternion identity  = Quaternion.identity;
                    GetLayoutStuff(boardSlot, ref zero, ref identity);

                    // Add object
                    GameObject gameObject = UnityEngine.Object.Instantiate((UnityEngine.Object)ShapeSpawner, zero, identity) as GameObject;
                    BoardSlotToVisualMap.Add(boardSlot, gameObject);
                    BoardSlotSphericalProxy slotproxy = gameObject.GetComponent <BoardSlotSphericalProxy>();
                    if ((UnityEngine.Object)slotproxy == (UnityEngine.Object)null)
                    {
                        slotproxy = gameObject.AddComponent <BoardSlotSphericalProxy>();
                        slotproxy.SetSlot(boardSlot);
                    }
                    BoardSlotToProxyMap.Add(boardSlot, slotproxy);
                    CacheSphericalProxyInfo(boardSlot, slotproxy);
                }
            }
        }
    }