Ejemplo n.º 1
0
    private GameObject CreateObj(PropsObject source, int index)
    {
        GameObject qhw = new GameObject("qhw" + index);

        qhw.transform.SetParent(emptyRoot.transform, false);
        if (index < 2)
        {
            GameObject scopy = GameObject.Instantiate(source.gameObject);
            scopy.GetComponent <PropsObject>().pData = source.pData;

            qhw.transform.SetParent(emptyRoot.transform, false);
            scopy.transform.SetParent(qhw.transform, false);
            scopy.transform.localPosition = Vector3.zero;
        }
        else
        {
            //第2个索引为触发的强化物
            goodA = GameObject.Instantiate(source.gameObject);
            goodA.transform.SetParent(emptyRoot.transform, false);
            goodA.GetComponent <PropsObject>().pData = source.pData;
            goodA.transform.localPosition            = new Vector3(9999, 9999, 9999);
            RndReinforcementA = qhwCtrl.GetObj(source.name);
        }
        string tukaNameA = "tuka_" + source.gameObject.name;

        qhwtks[index] = GameObject.Instantiate(DistinguishPictureModel.GetInstance().GetTuKa(tukaNameA));
        qhwtks[index].transform.SetParent(index > 1 ? twopage.transform : onepage.transform, false);
        qhwtks[index].transform.localPosition = qhwtkPos[index];
        qhwtks[index].transform.localScale    = new Vector3(0.5f, 1, 0.5f);
        return(qhw);
    }
Ejemplo n.º 2
0
    void Start()
    {
        GlobalEntity.GetInstance().Dispatch <string>(CommonUI.pEvent.LevelChange, "第二关");
        GameObject xiaohuaGo = PeopleManager.Instance.GetPeople("XH_BD");

        if (xiaohuaGo.GetComponent <XHCtrl>() == null)
        {
            xiaohuaGo.AddComponent <XHCtrl>().InitComplete = () =>
            {
                xiaohuaGo.GetComponent <XHCtrl>().r_tuka.SetActive(false);
                xiaohuaGo.GetComponent <XHCtrl>().r_tuka2.SetActive(false);
                xiaohuaGo.GetComponent <XHCtrl>().r_judai.SetActive(false);
                xiaohuaGo.GetComponent <XHCtrl>().r_judai2.SetActive(false);
            };
        }
        emptyRoot = new GameObject("Root");

        GameObject qhwm = ObjectsManager.instanse.GetQHW();

        qhwm.transform.SetParent(emptyRoot.transform);
        qhwCtrl = qhwm.GetComponent <QHWCtrl>();

        //生成我要句带源
        judaiGobj = GameObject.Instantiate(ObjectsManager.instanse.propList[(int)PropsTag.judai_woyao].gameObject);
        judaiGobj.GetComponent <PropsObject>().pData = ObjectsManager.instanse.propList[(int)PropsTag.judai_woyao].pData;
        judaiGobj.transform.SetParent(emptyRoot.transform, false);
        judaiGobj.transform.localPosition = new Vector3(0.083f, 0.0019f, 0);

        //随机一个强化物A
        goodA = SpeakUpModel.GetInstance().GetRndReinforcement();
        qhwCtrl.GetObj(goodA.name);

        //强化物图卡A
        string tukaNameA = "tuka_" + goodA.name;

        tukaA = GameObject.Instantiate(DistinguishPictureModel.GetInstance().GetTuKa(tukaNameA));
        GameObject _tukaA = new GameObject("tukaA");

        _tukaA.transform.SetParent(emptyRoot.transform, false);
        _tukaA.transform.localPosition = new Vector3(999f, 999f, 999f);
        tukaA.transform.SetParent(_tukaA.transform, false);
        tukaA.transform.localPosition = Vector3.zero;

        FBNKT_KA_Anim      = ResManager.GetPrefab("Prefabs/AnimationKa/XH_D_2ND_FYFT_KA");
        FBNKT_KA_Anim.name = "XH_D_2ND_FYFT_KA";
        FBNKT_KA_Anim.transform.SetParent(emptyRoot.transform, false);
        //我要图卡
        FBNKT_KA_Anim.transform.Find("XH_judaiA/XH_judaiA 1/tukaA/tukaA 1").GetComponent <MeshRenderer>().materials[1].CopyPropertiesFromMaterial(judaiGobj.GetComponent <MeshRenderer>().materials[1]);
        //强化物图卡
        FBNKT_KA_Anim.transform.Find("XH_judaiA/XH_judaiA 1/tukaB/tukaB 1").GetComponent <MeshRenderer>().materials[1].CopyPropertiesFromMaterial(tukaA.GetComponent <MeshRenderer>().materials[1]);
        FBNKT_KA_Anim.transform.Find("XH_judaiA/XH_judaiA 1/tukaB").gameObject.SetActive(false);

        PeopleManager.Instance.GetPeople("FDLS_BD").SetActive(false);

        //1. 进入界面1秒后,触动小华翻开沟通本,并把字卡和图卡都粘在句带的动画。
        Invoke("OnXiaoHuaBring", 1f);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 初始化物品状态
    /// </summary>
    void InitGoodsState()
    {
        GameObject qhw = ObjectsManager.instanse.GetQHW();

        qhw.transform.SetParent(emptyRoot.transform);
        qhwCtrlA = qhw.GetComponent <QHWCtrl>();
        qhwCtrlA.transform.localPosition = new Vector3(-0.127f, 0, 0.371f);

        GameObject qhwB = ObjectsManager.instanse.GetQHW();

        qhwB.transform.SetParent(emptyRoot.transform);
        qhwCtrlB = qhwB.GetComponent <QHWCtrl>();
        qhwCtrlB.transform.localPosition = new Vector3(-0.101f, 0, 0);

        List <PropsObject> results = new List <PropsObject>();

        //随机一个强化物A和强化物B
        DistinguishPictureModel.GetInstance().GetRndReinforcements(2, results);
        qhwCtrlA.GetObj(results[0].pData.name);
        goodA = GameObject.Instantiate(results[0].gameObject);
        goodA.GetComponent <PropsObject>().pData = results[0].pData;
        goodA.transform.SetParent(emptyRoot.transform, false);
        goodA.transform.localPosition = new Vector3(9999, 9999, 9999);

        //强化物图卡A
        string tukaNameA = "tuka_" + results[0].pData.name;

        tukaA  = GameObject.Instantiate(DistinguishPictureModel.GetInstance().GetTuKa(tukaNameA));
        _tukaA = new GameObject("tukaA");
        _tukaA.transform.SetParent(emptyRoot.transform, false);
        _tukaA.transform.localPosition = new Vector3(2.262f, 0.5466f, 0.393f);
        tukaA.transform.SetParent(_tukaA.transform, false);
        tukaA.transform.localPosition = Vector3.zero;

        //随机一个强化物B
        goodB = GameObject.Instantiate(results[1].gameObject);
        goodB.GetComponent <PropsObject>().pData = results[1].pData;
        goodB.transform.SetParent(emptyRoot.transform, false);
        goodB.transform.localPosition = new Vector3(9999, 9999, 9999);
        RndReinforcementB             = qhwCtrlB.GetObj(results[1].pData.name);
        goodB.name = results[1].pData.name;

        //强化物图卡B
        string tukaNameB = "tuka_" + results[1].pData.name;

        tukaB = GameObject.Instantiate(DistinguishPictureModel.GetInstance().GetTuKa(tukaNameB));
        GameObject _tukaB = new GameObject("tukaB");

        _tukaB.transform.SetParent(emptyRoot.transform, false);
        _tukaB.transform.SetAsFirstSibling();

        _tukaB.transform.localPosition = new Vector3(2.2433f, 0.5438f, 0.4231f);
        tukaB.transform.SetParent(_tukaB.transform, false);
        tukaB.transform.localPosition = Vector3.zero;
    }
Ejemplo n.º 4
0
    void Start()
    {
        GlobalEntity.GetInstance().Dispatch <string>(CommonUI.pEvent.LevelChange, "第三关");
        GameObject qhwm = ObjectsManager.instanse.GetQHW();

        qhwm.transform.SetParent(emptyRoot.transform);
        qhwCtrl = qhwm.GetComponent <QHWCtrl>();

        //初始化沟通本
        PropsObject gtbProp = ObjectsManager.instanse.GetProps((int)PropsTag.TY_GTB);

        gtNotebook = GameObject.Instantiate(gtbProp.gameObject);
        gtNotebook.GetComponent <PropsObject>().pData = gtbProp.pData;
        gtNotebook.transform.SetParent(emptyRoot.transform, false);
        gtNotebook.transform.localPosition = new Vector3(2.2851f, 0.56572f, 0.3776f);
        onepage = gtNotebook.transform.Find("goutongben_02").gameObject;
        twopage = gtNotebook.transform.Find("goutongben_03").gameObject;

        List <PropsObject> rndReinforcements = new List <PropsObject>();

        DistinguishPictureModel.GetInstance().GetRndReinforcements(3, rndReinforcements);
        int i = 0;

        //初始化摆放强化物
        rndReinforcements.ForEach((ob) =>
        {
            GameObject qhw = CreateObj(ob, i);
            qhw.transform.localPosition = qhwPos[i++];
        });


        List <PropsObject> rndNegReinforcements = new List <PropsObject>();

        DistinguishPictureModel.GetInstance().GetRndNegReinforcements(2, rndNegReinforcements);
        i = 0;
        //初始化摆放负强化物
        rndNegReinforcements.ForEach((ob) =>
        {
            GameObject nqhw = CreateNegObj(ob, i);
            if (ob.name == "apple")
            {
                nqhwPos[i].y = 0.604f;
            }
            nqhw.transform.localPosition = nqhwPos[i++];
        });

        teacherAnim = PeopleManager.Instance.GetPeople("LS_BD").GetAnimatorOper();

        //1. 进入界面后1秒,触发小华翻开沟通本并拿出图卡,递给老师的动画。
        Invoke("OnXiaoHuaPassGouTongBenToTeacher", 1f);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 初始化物品状态
    /// </summary>
    void InitGoodsState()
    {
        GameObject qhw = ObjectsManager.instanse.GetQHW();

        qhw.transform.SetParent(emptyRoot.transform);
        qhw.transform.localPosition = new Vector3(-0.032f, 0, -0.183f);
        qhwCtrl = qhw.GetComponent <QHWCtrl>();

        GameObject qhwB = GameObject.Instantiate(qhw);

        qhwB.transform.SetParent(emptyRoot.transform);
        qhwB.name = "qhwB";
        qhwCtrlB  = qhwB.GetComponent <QHWCtrl>();

        //随机一个强化物A
        goodA             = DistinguishPictureModel.GetInstance().GetRndReinforcement();
        RndReinforcementA = qhwCtrl.GetObj(goodA.name);

        //强化物图卡A
        string tukaNameA = "tuka_" + goodA.name;

        tukaA  = GameObject.Instantiate(DistinguishPictureModel.GetInstance().GetTuKa(tukaNameA));
        _tukaA = new GameObject("tukaA");
        _tukaA.transform.SetParent(emptyRoot.transform, false);
        _tukaA.transform.localPosition = new Vector3(2.199f, 0.545f, 0.406f);
        tukaA.transform.SetParent(_tukaA.transform, false);
        tukaA.transform.localPosition = Vector3.zero;


        //随机一个负强化物B
        goodB = DistinguishPictureModel.GetInstance().GetRndNegReinforcement();
        RndNegReinforcementB = qhwCtrlB.GetObj(goodB.name);

        //负强化物图卡B
        string tukaNameB = "tuka_" + goodB.name;

        tukaB = GameObject.Instantiate(DistinguishPictureModel.GetInstance().GetTuKa(tukaNameB));
        GameObject _tukaB = new GameObject("tukaB");

        _tukaB.transform.SetParent(emptyRoot.transform, false);

        _tukaB.transform.localPosition = new Vector3(2.223f, 0.5466f, 0.388f);
        tukaB.transform.SetParent(_tukaB.transform, false);
        tukaB.transform.localPosition = Vector3.zero;
    }
Ejemplo n.º 6
0
    private GameObject CreateNegObj(PropsObject source, int index)
    {
        GameObject scopy = GameObject.Instantiate(source.gameObject);

        scopy.GetComponent <PropsObject>().pData = source.pData;
        GameObject nqhw = new GameObject("nqhw" + index);

        nqhw.transform.SetParent(emptyRoot.transform, false);
        scopy.transform.SetParent(nqhw.transform, false);
        scopy.transform.localPosition = Vector3.zero;

        string tukaNameB = "tuka_" + source.gameObject.name;

        nqhwtks[index] = GameObject.Instantiate(DistinguishPictureModel.GetInstance().GetTuKa(tukaNameB));

        nqhwtks[index].transform.SetParent(onepage.transform, false);
        nqhwtks[index].transform.localPosition = nqhwtkPos[index];
        nqhwtks[index].transform.localScale    = new Vector3(0.5f, 1, 0.5f);
        return(nqhw);
    }
Ejemplo n.º 7
0
    private GameObject lsjudai; //老师句带
    void Start()
    {
        GlobalEntity.GetInstance().Dispatch <string>(CommonUI.pEvent.LevelChange, "第三关");
        GameObject xiaohuaGo = PeopleManager.Instance.GetPeople("XH_BD");

        GlobalDataManager.GetInstance().SetPcesCamera(Vector3.zero);

        Transform zhuozi2 = EnhanceCommunityModel.GetInstance().Jiaoshi().transform.Find("shinei/zhuozi2");

        zhuozi2Pos            = zhuozi2.transform.localPosition;
        zhuozi2.localPosition = new Vector3(0.0608f, 0, 0.036536f);

        if (xiaohuaGo.GetComponent <XHCtrl>() == null)
        {
            xiaohuaGo.AddComponent <XHCtrl>().InitComplete = () =>
            {
                xiaohuaGo.GetComponent <XHCtrl>().r_tuka.SetActive(false);
                xiaohuaGo.GetComponent <XHCtrl>().r_tuka2.SetActive(false);
                xiaohuaGo.GetComponent <XHCtrl>().r_judai.SetActive(false);
                xiaohuaGo.GetComponent <XHCtrl>().r_judai2.SetActive(false);
            };
        }

        //初始化老师位置和相机位置
        LS       = PeopleManager.Instance.GetPeople("LS_BD").GetAnimatorOper();
        lsOldPos = LS.transform.localPosition;
        LS.transform.localPosition = new Vector3(1.516f, 0.02f, 0.022f);
        emptyRoot = new GameObject("Root");

        GameObject qhwm = ObjectsManager.instanse.GetQHW();

        qhwm.transform.SetParent(emptyRoot.transform, false);
        qhwCtrl = qhwm.GetComponent <QHWCtrl>();
        qhwCtrl.transform.localPosition = new Vector3(1.508f, 0, 0);

        //生成我要句带
        GameObject judaiParent = new GameObject("judaiParent");

        judaiParent.transform.SetParent(emptyRoot.transform, false);
        judaiParent.transform.localPosition = new Vector3(10000f, 0.549f, -0.334f);
        judaiGobj = GameObject.Instantiate(ObjectsManager.instanse.propList[(int)PropsTag.judai_woyao].gameObject);
        judaiGobj.GetComponent <PropsObject>().pData = ObjectsManager.instanse.propList[(int)PropsTag.judai_woyao].pData;
        judaiGobj.transform.SetParent(judaiParent.transform, false);

        //随机一个强化物A
        goodA = SpeakUpModel.GetInstance().GetRndReinforcement();

        RndReinforcementA = qhwCtrl.GetObj(goodA.name);

        //强化物图卡A
        string tukaNameA = "tuka_" + goodA.name;

        tukaA = Instantiate(DistinguishPictureModel.GetInstance().GetTuKa(tukaNameA));
        GameObject _tukaA = new GameObject("tukaA");

        _tukaA.transform.SetParent(emptyRoot.transform, false);
        _tukaA.transform.localPosition = new Vector3(999f, 999f, 999f);
        tukaA.transform.SetParent(_tukaA.transform, false);
        tukaA.transform.localPosition = Vector3.zero;

        FBNKT_KA_Anim      = ResManager.GetPrefab("Prefabs/AnimationKa/XH_D_2ND_FYFT_KA");
        FBNKT_KA_Anim.name = "XH_D_2ND_FYFT_KA";
        FBNKT_KA_Anim.transform.SetParent(emptyRoot.transform, false);

        //我要图卡
        FBNKT_KA_Anim.transform.Find("XH_judaiA/XH_judaiA 1/tukaA/tukaA 1").GetComponent <MeshRenderer>().materials[1].CopyPropertiesFromMaterial(judaiGobj.GetComponent <MeshRenderer>().materials[1]);
        //强化物图卡
        FBNKT_KA_Anim.transform.Find("XH_judaiA/XH_judaiA 1/tukaB/tukaB 1").GetComponent <MeshRenderer>().materials[1].CopyPropertiesFromMaterial(tukaA.GetComponent <MeshRenderer>().materials[1]);
        FBNKT_KA_Anim.transform.Find("XH_judaiA/XH_judaiA 1/tukaB").gameObject.SetActive(false);
        PeopleManager.Instance.GetPeople("FDLS_BD").SetActive(false);

        GameObject deskTuka = ObjectsManager.instanse.GetdeskTuka();//桌面图卡

        deskTuka.transform.SetParent(transform);
        deskTuka.name = "DeskTuka";
        deskTuka.transform.localPosition = new Vector3(1.485f, 0.0014f, 0.082f);
        TukaCtrl tukaCtrl = deskTuka.GetComponent <TukaCtrl>();

        lsjudai = tukaCtrl.ShowObj("LS_judai");
        lsjudai.transform.Find("LS_judai 1/jd_tuka").gameObject.SetActive(false);
        lsjudai.transform.Find("LS_judai 1/jd_tuka2").GetComponentInChildren <MeshRenderer>().materials[1].CopyPropertiesFromMaterial(tukaA.GetComponent <MeshRenderer>().materials[1]);
        lsjudai.transform.Find("LS_judai 1/LS_TUKA").GetComponentInChildren <MeshRenderer>().materials[1].CopyPropertiesFromMaterial(judaiGobj.GetComponent <MeshRenderer>().materials[1]);
        lsjudai.SetActive(false);

        xiaohuaAnim = xiaohuaGo.GetAnimatorOper();
        xhCtrl      = xiaohuaAnim.GetComponent <XHCtrl>();
        //进入界面1秒后,触动小华翻开沟通本,并把字卡和图卡都粘在句带,并走到老师的面前的动画。
        Invoke("OnXiaoHuaBring", 1f);
    }