コード例 #1
0
    public void modKomanariObj(string objName, string narigomaName, int x, int y)
    {
        string      objNarigomaName = CreateKomaObj(narigomaName, x, y);
        MasuManager manager         = MasuManager.Instance;

        manager.SetMasu(x, y, KomaFunction.GetKomaNameByObjName(objNarigomaName));
        manager.UpdMasuObjNameByXAndY(objNarigomaName, x, y);
        DestroyKomaObj(objName);
    }
コード例 #2
0
    // 駒移動処理
    public void MoveKomaObj(string name, int x, int y)
    {
        bool motigomaFlag = false;

        // 持ち駒の場合
        if (name.IndexOf(KomaConst.motigoma) > -1)
        {
            name = name.Replace(KomaConst.motigoma, "");
            MotigomaManager motigomaManager = MotigomaManager.Instance;
            motigomaManager.Minus(name);
            if (KomaFunction.isSelfKoma(name))
            {
                GameObject     obj = transform.Find("../Motigoma1").gameObject;
                MotigomaScript mSc = obj.GetComponent <MotigomaScript> ();
                mSc.RefreshKoma();
            }
            else
            {
                GameObject     obj = transform.Find("../Motigoma2").gameObject;
                MotigomaScript mSc = obj.GetComponent <MotigomaScript> ();
                mSc.RefreshKoma();
            }
            name = CreateKomaObj(name, x, y);
            MasuManager manager = MasuManager.Instance;
            manager.SetMasu(x, y, KomaFunction.GetKomaNameByObjName(name));
            manager.UpdMasuObjNameByXAndY(name, x, y);
            motigomaFlag = true;
        }
        GameObject gameObj = GameObject.Find(name);
        KomaScript sc      = gameObj.GetComponent <KomaScript> ();

        gameObj.transform.position = new Vector3(basex - per1x * x, basey - per1y * y, 2);
        // 持ち駒でない場合
        if (!motigomaFlag)
        {
            Debug.Log("motigomadenai " + name);
            execCheckGetEnemyKoma(name, x, y);
            execCheckNarigoma(name, x, y);
            // 移動前のマスを初期化
            MasuManager manager = MasuManager.Instance;
            manager.EmptyMasu(sc.x, sc.y);
            sc.x = x;
            sc.y = y;
            manager.SetMasu(x, y, KomaFunction.GetKomaNameByObjName(name));
            manager.UpdMasuObjNameByXAndY(name, x, y);
        }
    }