Example #1
0
    /// <summary>
    /// 初始化桌子上的涂卡
    /// </summary>
    void GetTukaObject()
    {
        if (GTB == null)
        {
            GameObject gtb = ResManager.GetPrefab("Prefabs/Objects/TY_GTB");
            gtb.name = "TY_GTB";
            gtb.transform.SetParent(transform);
            gtb.transform.localPosition = new Vector3(-2.67f, 0.5672f, -0.406f);
            GTB = gtb.AddComponent <AnimationOper>();
        }
        //Reinforcement rfc = EnhanceCommunityModel.GetInstance().CurReinforcement;
        //rfc = new Reinforcement(new PropsData("chips", 2, PropsType.reinforcement, "薯片"));//测试代码
        Reinforcement rfc = GlobalDataManager.GetInstance().CurReinforcement;

        EnhanceCommunityModel.GetInstance().CurReinforcement = rfc;
        if (rfc != null)
        {
            Debug.Log("GetTukaObject");

            int objId = rfc.pData.id;
            qhw = ObjectsManager.instanse.GetQHW();
            qhw.transform.SetParent(transform);
            string qhwName = ((PropsTag)objId).ToString();
            qhw.name = qhwName;
            QHWCtrl qhwCtrl = qhw.GetComponent <QHWCtrl>();
            qhwCtrl.ShowObj(qhwName);

            string   _tuka     = "tuka_" + ((PropsTag)objId).ToString();
            Material matSource = EnhanceCommunityModel.GetInstance().GetTuKa(_tuka).GetComponent <MeshRenderer>().materials[1]; //图卡材质
            deskTuka = ObjectsManager.instanse.GetdeskTuka();                                                                   //桌面图卡
            deskTuka.transform.SetParent(transform);
            deskTuka.name = _tuka;

            TukaCtrl tukaCtrl = deskTuka.GetComponent <TukaCtrl>();
            xhTk = tukaCtrl.ShowObj("XH_GTB_TUKA");
            Material matTar = xhTk.GetComponent <MeshRenderer>().materials[1];
            matTar.CopyPropertiesFromMaterial(matSource);
            xhTk.gameObject.SetActive(false);

            lsTk   = tukaCtrl.GetObj("LS_JZS_TUKA");
            matTar = lsTk.GetComponent <MeshRenderer>().materials[1];
            matTar.CopyPropertiesFromMaterial(matSource);

            Invoke("XhTakeCard", 1);
        }
        else
        {
            Tip();
        }
    }
Example #2
0
    /// <summary>
    /// 初始化桌子上的涂卡
    /// </summary>
    void GetTukaObject()
    {
        Reinforcement rfc = SwapModel.GetInstance().CurReinforcement;

        //rfc = new Reinforcement(new PropsData("chips", 2, PropsType.reinforcement, "薯片"));//测试代码
        if (rfc != null)
        {
            Debug.Log("GetTukaObject");

            int objId = rfc.pData.id;
            qhw = ObjectsManager.instanse.GetQHW();
            qhw.transform.SetParent(transform);
            string qhwName = ((PropsTag)objId).ToString();
            qhw.name = qhwName;
            QHWCtrl qhwCtrl = qhw.GetComponent <QHWCtrl>();
            qhwCtrl.ShowObj(qhwName);

            string     _tuka     = "tuka_" + ((PropsTag)objId).ToString();
            Material   matSource = SwapModel.GetInstance().GetTuKa(_tuka).GetComponent <MeshRenderer>().materials[1]; //图卡材质
            GameObject deskTuka  = ObjectsManager.instanse.GetdeskTuka();                                             //桌面图卡
            deskTuka.transform.SetParent(transform);
            deskTuka.name = _tuka;

            TukaCtrl tukaCtrl = deskTuka.GetComponent <TukaCtrl>();
            xhTk = tukaCtrl.ShowObj("XH_ZS_TUKA");
            Material matTar = xhTk.GetComponent <MeshRenderer>().materials[1];
            matTar.CopyPropertiesFromMaterial(matSource);

            lsTk   = tukaCtrl.GetObj("LS_JZS_TUKA");
            matTar = lsTk.GetComponent <MeshRenderer>().materials[1];
            matTar.CopyPropertiesFromMaterial(matSource);

            Invoke("XhTakeCard", 1);
        }
        else
        {
            Tip();
        }
    }
Example #3
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);
    }