Esempio n. 1
0
        private bool IsInBounds(Vector3Int targetDirection)
        {
            Vector3Int targetPosition = piecePosition + targetDirection - activePiece.PivotLocalPosition;

            foreach (Vector3Int cubePos in activePiece.CubesLocalPositions)
            {
                Vector3Int cubePosition = targetPosition + cubePos;
                if (cubePosition.x < 0 || cubePosition.x >= matrixDimensions.x || cubePosition.z < 0 ||
                    cubePosition.z >= matrixDimensions.z)
                {
                    return(false);
                }
            }

            return(!gameMatrix.IsOverlapping(activePiece, piecePosition + targetDirection));
        }