예제 #1
0
파일: Game.cs 프로젝트: psmon/chessgo
    public void SwapDolPos(VectorDol leftPos, VectorDol rightPos)
    {
        PlayDol left  = Dols.getPlayDolByIdx(leftPos.x, leftPos.y);
        PlayDol right = Dols.getPlayDolByIdx(rightPos.x, rightPos.y);

        if (left != null && right != null)
        {
            Vector3 oriPos = left.transform.position;
            //left.transform.position = right.transform.position;

            left.move_ani(right.transform.position);

            right.transform.position = oriPos;

            VectorDol temp = new VectorDol();
            temp.setPos(left.GetDolPos());

            left.SetDolPos(right.GetDolPos());
            right.SetDolPos(temp);
        }

        curPlayDol = left;
        WebDataRes chkRes = new WebDataRes();

        chkRes.pid = "CheckGame";
        packetList.Enqueue(chkRes.ToString());
    }
예제 #2
0
    public void InitDols()
    {
        //GameObject dol = (GameObject)Instantiate(Resources.Load("Images"));
        for (int idx = 0; idx < 8; idx++)
        {
            for (int idy = 0; idy < 8; idy++)
            {
                GameObject dol = Instantiate(playDol, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
                dol.transform.position = getPosByIdx(idx, idy);
                PlayDol pdol = dol.GetComponent <PlayDol>();
                ;

                if (getDolTypeByIdx(idx, idy) == 1)
                {
                    pdol.SetDolColor(1);
                    pdol.SetDolPos(idx, idy);
                    wplayDols[idx] = dol;
                    dol.name       = "whiteDol-" + idx;
                }
                else if (getDolTypeByIdx(idx, idy) == 2)
                {
                    pdol.SetDolColor(2);
                    pdol.SetDolPos(idx, idy);
                    bplayDols[idx] = dol;
                    dol.name       = "blackDol-" + idx;
                }
                else
                {
                    pdol.SetDolColor(0);
                    pdol.SetDolPos(idx, idy);
                    dol.name = "empty-" + idx + ":" + idy;
                }

                allDols.Add(dol);
            }
        }
    }