Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        mBoard     = FindObjectOfType <Normal.Board>();
        mHexaBoard = FindObjectOfType <Hexa.Board>();

        if (mBoard != null)
        {
            RepositionCamera(mBoard.width - 1, mBoard.height - 1, mBoard.width, mBoard.height);
        }
        else if (mHexaBoard != null)
        {
            RepositionCamera(mHexaBoard.totalWidth - 1, mHexaBoard.maxHeight - 1, mHexaBoard.totalWidth, mHexaBoard.maxHeight);
        }
    }
Esempio n. 2
0
    void MakeBoard(int minHeight, int maxHeight, int totalWidth)
    {
        Board board = FindObjectOfType <Board>();

        Normal.Board normalBoard = FindObjectOfType <Normal.Board>();

        if (board != null)
        {
            DestroyImmediate(board.gameObject, true);
        }
        else if (normalBoard != null)
        {
            DestroyImmediate(normalBoard.gameObject, true);
        }

        GameObject tmpBoard = new GameObject("Board");

        tmpBoard.AddComponent <Board>();
        board = tmpBoard.GetComponent <Board>();

        GameObject node = new GameObject("Node");

        node.AddComponent <Node>();
        node.AddComponent <CircleCollider2D>();
        node.GetComponent <CircleCollider2D>().radius = 0.4f;
        node.layer = LayerMask.NameToLayer("Node");
        nodePath   = MakePrefab(node);
        DestroyImmediate(node, true);

        board.maxHeight  = maxHeight;
        board.minHeight  = minHeight;
        board.totalWidth = totalWidth;

        board.nodePrefab = AssetDatabase.LoadAssetAtPath <GameObject>(nodePath);

        AddCameraScalar();
        MakeFindMatches();
    }
Esempio n. 3
0
 // Start is called before the first frame update
 void Start()
 {
     board           = FindObjectOfType <Normal.Board>();
     hintDelaySecond = hintDelay;
 }
Esempio n. 4
0
    public void CheckNearDots_Normal()
    {
        Normal.Dot   dot         = this.gameObject.GetComponent <Normal.Dot>();
        Normal.Board normalBoard = board.GetComponent <Normal.Board>();

        if (dot != null)
        {
            if (count <= 0)
            {
                // 보드에서 장애물 갯수를 하나 줄이고
                normalBoard.obstacles.Dequeue();
                // 나의 매치 상태를 true로 -> 사라질때 처리를 Dot과 한꺼번에
                dot.isMatched = true;
            }

            if (dot.column - 1 > 0)
            {
                if (normalBoard.dots[dot.column - 1, dot.row] != null && normalBoard.dots[dot.column - 1, dot.row].GetComponent <Normal.Dot>() != null)
                {
                    if (normalBoard.dots[dot.column - 1, dot.row].GetComponent <Normal.Dot>().isMatched == true)
                    {
                        this.gameObject.GetComponent <SpriteRenderer>().color *= 0.6f;
                        count--;

                        return;
                    }
                }
            }
            if (dot.column + 1 < normalBoard.width)
            {
                if (normalBoard.dots[dot.column + 1, dot.row] != null && normalBoard.dots[dot.column + 1, dot.row].GetComponent <Normal.Dot>() != null)
                {
                    if (normalBoard.dots[dot.column + 1, dot.row].GetComponent <Normal.Dot>().isMatched == true)
                    {
                        this.gameObject.GetComponent <SpriteRenderer>().color *= 0.6f;
                        count--;

                        return;
                    }
                }
            }
            if (dot.row - 1 > 0)
            {
                if (normalBoard.dots[dot.column, dot.row - 1] != null && normalBoard.dots[dot.column, dot.row - 1].GetComponent <Normal.Dot>() != null)
                {
                    if (normalBoard.dots[dot.column, dot.row - 1].GetComponent <Normal.Dot>().isMatched == true)
                    {
                        this.gameObject.GetComponent <SpriteRenderer>().color *= 0.6f;
                        count--;

                        return;
                    }
                }
            }
            if (dot.row + 1 < normalBoard.height)
            {
                if (normalBoard.dots[dot.column, dot.row + 1] != null && normalBoard.dots[dot.column, dot.row + 1].GetComponent <Normal.Dot>() != null)
                {
                    if (normalBoard.dots[dot.column, dot.row + 1].GetComponent <Normal.Dot>().isMatched == true)
                    {
                        this.gameObject.GetComponent <SpriteRenderer>().color *= 0.6f;
                        count--;

                        return;
                    }
                }
            }
        }
    }