Example #1
0
    void Start()
    {
        // 初期化.
        m_VictoryOrDefeat = VictoryOrDefeat.Draw;
        m_SetAvailableManager = true;
        m_PassCount = 0;
        m_TurnCount = 1;
        m_Log = GameObject.Find("Log").GetComponent<Log>();
        m_VictoryOrDefeatText = GameObject.Find("VictoryOrDefeat").GetComponent<VictoryOrDefeatText>();
        m_GameSet.Add (GameObject.Find("PanelFront")as GameObject);
        m_GameSet.Add (GameObject.Find("PanelBG") as GameObject);
        m_GameSet.Add (GameObject.Find("Result") as GameObject);
        ui = GameObject.Find ("Text").GetComponent<Ui>();
        m_TurnWait = false;
        gameInfo = GameObject.Find ("GameInfo").GetComponent<GameInfo>();

        // タイル配置.
        int count = 0;
        Vector3 tilePos = Vector3.zero;
        for (int row = 0; row < ROW; row++)
        {
            m_Tile.GetComponent<Tile>().Row = row;
            for(int column = 0; column < COLUMN; column++)
            {
                tilePos = new Vector3((m_Tile.transform.localScale.x + MARGE) * row,
                                      (m_Tile.transform.localScale.y + MARGE)* column,
                                      0);

                if(m_Tile != null)
                {
                    m_TileArray[count] = (GameObject)GameObject.Instantiate(m_Tile, tilePos, Quaternion.identity);
                    m_TileArray[count].name = "" + (row+1) + (column+1);
                    m_TileArray[count].GetComponent<Tile>().Num = count;
                    m_TileArray[count].GetComponent<Tile>().Column = column;

                }
                count++;
            }
        }

        // 石配置.

        m_StoneList.Add (CreateStone(MatrixPos(ROW/2 -1, COLUMN/2 - 1),false));	m_StoneList [0].name = "stone0";	m_TileArray[MatrixBox(ROW/2 -1, COLUMN/2 - 1)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (ROW/2 -1, COLUMN/2 - 1)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (ROW/2 -1, COLUMN/2 - 1)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [0].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(ROW/2 -1, COLUMN/2),true));	m_StoneList [1].name = "stone1";	m_TileArray[MatrixBox(ROW/2 -1, COLUMN/2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (ROW/2 -1, COLUMN/2)].GetComponent<Tile> ().StoneColor = true;	 m_TileArray [MatrixBox (ROW/2 -1, COLUMN/2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [1].GetComponent<Stone> ().StoneColor = true;
        m_StoneList.Add (CreateStone(MatrixPos(ROW/2, COLUMN/2 - 1),true));	m_StoneList [2].name = "stone2";	m_TileArray[MatrixBox(ROW/2, COLUMN/2 - 1)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (ROW/2, COLUMN/2 - 1)].GetComponent<Tile> ().StoneColor = true;	 m_TileArray [MatrixBox (ROW/2, COLUMN/2 - 1)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [2].GetComponent<Stone> ().StoneColor = true;
        m_StoneList.Add (CreateStone(MatrixPos(ROW/2, COLUMN/2),false));	m_StoneList [3].name = "stone3";	m_TileArray[MatrixBox(ROW/2, COLUMN/2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (ROW/2, COLUMN/2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (ROW/2, COLUMN/2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [3].GetComponent<Stone> ().StoneColor = false;

        /*
        m_StoneList.Add (CreateStone(MatrixPos(3, 3),true));	m_StoneList [0].name = "stone0";	m_TileArray[MatrixBox(3,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 3)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (3, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [0].GetComponent<Stone> ().StoneColor = true;
        m_StoneList.Add (CreateStone(MatrixPos(2, 2),false));	m_StoneList [1].name = "stone1";	m_TileArray[MatrixBox(2,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (2, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [1].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(2, 3),false));	m_StoneList [2].name = "stone2";	m_TileArray[MatrixBox(2,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 3)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (2, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [2].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(2, 4),false));	m_StoneList [3].name = "stone3";	m_TileArray[MatrixBox(2,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 4)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (2, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [3].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(3, 2),false));	m_StoneList [4].name = "stone4";	m_TileArray[MatrixBox(3,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (3, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [4].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(3, 4),false));	m_StoneList [5].name = "stone5";	m_TileArray[MatrixBox(3,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 4)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (3, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [5].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 2),false));	m_StoneList [6].name = "stone6";	m_TileArray[MatrixBox(4,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (4, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [6].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 3),false));	m_StoneList [7].name = "stone7";	m_TileArray[MatrixBox(4,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 3)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (4, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [7].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 4),false));	m_StoneList [8].name = "stone8";	m_TileArray[MatrixBox(4,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 4)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (4, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [8].GetComponent<Stone> ().StoneColor = false;

        */
        /*
        m_StoneList.Add (CreateStone(MatrixPos(3, 3),true));	m_StoneList [0].name = "stone0";	m_TileArray[MatrixBox(3,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 3)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (3, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [0].GetComponent<Stone> ().StoneColor = true;
        m_StoneList.Add (CreateStone(MatrixPos(2, 2),true));	m_StoneList [1].name = "stone1";	m_TileArray[MatrixBox(2,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 2)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (2, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [1].GetComponent<Stone> ().StoneColor = false;
        //		m_StoneList.Add (CreateStone(MatrixPos(2, 3),false));	m_StoneList [2].name = "stone2";	m_TileArray[MatrixBox(2,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 3)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (2, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [2].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(2, 4),true));	m_StoneList [2].name = "stone3";	m_TileArray[MatrixBox(2,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 4)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (2, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [2].GetComponent<Stone> ().StoneColor = false;
        //		m_StoneList.Add (CreateStone(MatrixPos(3, 2),false));	m_StoneList [4].name = "stone4";	m_TileArray[MatrixBox(3,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (3, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [4].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(3, 4),false));	m_StoneList [3].name = "stone5";	m_TileArray[MatrixBox(3,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 4)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (3, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [3].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 2),true));	m_StoneList [4].name = "stone6";	m_TileArray[MatrixBox(4,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 2)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (4, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [4].GetComponent<Stone> ().StoneColor = false;
        //		m_StoneList.Add (CreateStone(MatrixPos(4, 3),false));	m_StoneList [7].name = "stone7";	m_TileArray[MatrixBox(4,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 3)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (4, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [7].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 4),true));	m_StoneList [5].name = "stone8";	m_TileArray[MatrixBox(4,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 4)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (4, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [5].GetComponent<Stone> ().StoneColor = false;
        */

        SetAvailable (false);
        // ターンの設定	初期は黒.
        m_TurnManager = false;

        //		Debug.Log ("boardHistory" + BoardHistory.Count);
        BoardLog (false);

        ui.SendMessage("SetText");
    }