예제 #1
0
    /// <summary>
    /// コマを失う
    /// </summary>
    /// <param name="obj"></param>
    public void LostATop(GameObject obj)
    {
        int id = obj.GetComponent <BattleTopCtrl>().topId;

        //持ち駒リストに追加する
        for (int i = 1; i <= 3; i++)
        {
            for (int j = 1; j <= 3; j++)
            {
                BoardIndex index = new BoardIndex(j, i);
                //コマがなければそこに移動
                if (!opponentTopStage.ChkBoardTop(index))
                {
                    opponentTopStage.SetBoardInf(id, obj, false, index);
                    Vector2 tmpPos = opponentTopStage.GetBoardPosByIndexChild(index);

                    //オブジェクトを移動
                    obj.transform.position = new Vector3(tmpPos.x, 1, tmpPos.y);
                    obj.GetComponent <BattleTopCtrl>().SetIsMine(false);
                    obj.GetComponent <BattleTopCtrl>().SetIndex(index);
                    return;
                }
            }
        }
    }
예제 #2
0
    /// <summary>
    /// コマを獲得する
    /// </summary>
    public void GetATop(GameObject obj)
    {
        int id = obj.GetComponent <BattleTopCtrl>().topId;

        //持ち駒リストに追加する
        for (int i = 3; i >= 1; i--)
        {
            for (int j = 3; j >= 1; j--)
            {
                BoardIndex index = new BoardIndex(j, i);
                //コマがなければそこに移動
                if (!myTopStage.ChkBoardTop(index))
                {
                    myTopStage.SetBoardInf(id, obj, true, index);
                    Vector2 tmpPos = myTopStage.GetBoardPosByIndexChild(index);

                    //オブジェクトを移動
                    obj.transform.position = new Vector3(tmpPos.x, 1, tmpPos.y);
                    obj.GetComponent <BattleTopCtrl>().SetIsMine(true);
                    obj.GetComponent <BattleTopCtrl>().SetIndex(index);
                    return;
                }
            }
        }
    }