Esempio n. 1
0
    // 보드 만들기
    void MakeBoard(int height, int width)
    {
        Board board = FindObjectOfType <Board>();

        Hexa.Board hexaBoard = FindObjectOfType <Hexa.Board>();

        if (board != null)
        {
            DestroyImmediate(board.gameObject);
        }
        else if (hexaBoard != null)
        {
            DestroyImmediate(hexaBoard.gameObject);
        }

        GameObject tmpBoard = new GameObject("Board");

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

        board.height = height;
        board.width  = width;

        MakeFindMatches();
        AddCameraScalar();
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        dot   = this.gameObject.GetComponent <Hexa.Dot>();
        board = FindObjectOfType <Hexa.Board>();

        // 주변을 체크해
        CheckNearNodes();
    }
Esempio n. 3
0
    // Start is called before the first frame update
    void Start()
    {
        mBoard = FindObjectOfType <Hexa.Board>();

        if (mBoard != null)
        {
            RepositionCamera(mBoard.totalWidth - 1, mBoard.maxHeight - 1);
        }
    }
Esempio n. 4
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. 5
0
    // 주변 노드들 탐지
    public void CheckNearNodes_Hexa()
    {
        Hexa.Dot   dot       = this.gameObject.GetComponent <Hexa.Dot>();
        Hexa.Board hexaBoard = board.GetComponent <Hexa.Board>();

        if (dot != null)
        {
            GameObject nodeObj = hexaBoard.nodes[dot.column][dot.row];

            // 차감 횟수가 0, 즉 다 터졌으면
            if (count <= 0)
            {
                // 보드에서 장애물 갯수를 하나 줄이고
                hexaBoard.obstacles.Dequeue();
                // 나의 매치 상태를 true로 -> 사라질때 처리를 Dot과 한꺼번에
                dot.isMatched = true;
            }

            // 나의 node정보가 있다면, 혹시모를 null 오류 방지
            if (nodeObj != null)
            {
                Hexa.Node node = nodeObj.GetComponent <Hexa.Node>();

                for (int i = 0; i < 6; i++)
                {
                    // 주변 노드가 있다면
                    if (node.nearNodes[i] != null)
                    {
                        // 주변에서 블럭이 터지면
                        if (node.nearNodes[i].GetComponent <Hexa.Node>().dot == null || node.nearNodes[i].GetComponent <Hexa.Node>().dot.GetComponent <Hexa.Dot>().isMatched == true)
                        {
                            // 나의 색깔을 0.6%정도로 변화시키고
                            this.gameObject.GetComponent <SpriteRenderer>().color *= 0.6f;
                            // 차감 횟수를 낮춘 후
                            count--;
                            // 나가, 왜? 주변에서 여러개가 한꺼번에 터져도 횟수는 한번만 차감되기 때문.
                            break;
                        }
                    }
                }
            }
        }
    }