Exemple #1
0
    /*/ Slider for exchange character.
     * public void LODControlSlider (Text label) {
     *      int aIdx = (int)ModelChangeSlider.value;
     *
     *      // change label.
     *      // string labelName = SetLabelName (aIdx);
     *      // label.text = "Model Change\n" + labelName;
     *      // StartCoroutine( ChangeLOD("Lady Santa " + labelName, aIdx) );
     * }*/

    // change character model.
    private IEnumerator ChangeLOD(string modelName, int selectedIdx)
    {
        int aIdx = activeLodIdx;

        activeLodIdx = selectedIdx;

        // play Idle 0.1 second before change character model.
        // It is prevent error of transform like weapon_point_hand
        // 0.1秒、IDLEを再生してからモデルを切り替える。.
        // 현재 표시 중인 모델에게 IDLE모션을 0.1초간 재생시킨 후 처리를 시작한다.
        chrCtrl.PlayClip(stateName[0], weaponPos[0]);
        yield return(new WaitForSeconds(0.1f));

        // chrCtrl.ChangeTexture(true);

        // disable all other character model.
        // 表示されるIdxではないキャラクターモデルは非表示にする。.
        // 표시되어야하는 Idx이외의 캐릭터 모델은 꺼준다.
        for (int i = 0; i < chrModel.Length; i++)
        {
            if (i != activeLodIdx)
            {
                chrModel[i].SetActive(false);
            }
        }

        // Active new chacter model and replace animator control script.
        // 次のキャラクターを表示し、アニメーター制御スクリプトを交換する。.
        // 현재 Idx의 캐릭터를 표시한 후 애니메이터 스크립트를 교환해준다.
        chrModel[activeLodIdx].SetActive(true);

        chrCtrl   = chrModel[activeLodIdx].GetComponent <SantaAnimatorControl>();
        chrModule = chrModel[activeLodIdx].GetComponent <ModuleSetupControl>();

        // to display same place.
        chrModel[activeLodIdx].transform.position = chrModel[aIdx].transform.position;
        chrModel[activeLodIdx].transform.rotation = chrModel[aIdx].transform.rotation;

        //update module
        chrModule.SetAllModule((int)moduleSlider [0].value, (int)moduleSlider [1].value, (int)moduleSlider [2].value, (int)moduleSlider [3].value);
        chrModule.SetAllColor((int)textureSlider [0].value, (int)textureSlider [1].value, (int)textureSlider [2].value, (int)textureSlider [3].value);
        chrModule.UpdateMeshData();
        chrCtrl.chrAnimator.Rebind();

        // play Idle.
        chrCtrl.PlayClip(stateName[0], weaponPos[0]);

        // set 3D model infomation newly.
        // meshInfoMsg = chrCtrl.MeshData();
        ModelInformationUI.GetComponentInChildren <Text>().text = modelName + "\n\n" + chrCtrl.MeshData();
        // replace target of camera.
        gameObject.GetComponent <CamControl>().target = chrModel[activeLodIdx].transform;
    }
Exemple #2
0
    private string[] iModeMsg = new string[3]; // Information text on the left side of the screen, in Interactive mode.

    void Start()
    {
        // Target to control of animator control script.
        chrCtrl   = chrModel[activeLodIdx].GetComponent <SantaAnimatorControl>();
        chrModule = chrModel[activeLodIdx].GetComponent <ModuleSetupControl>();

        // set 3D model information.
        chrModule.SetAllModule(0, 0, 0, 0);
        chrModule.UpdateMeshData();
        chrCtrl.chrAnimator.Rebind();
        ModelInformationUI.GetComponentInChildren <Text> ().text = "Lady Santa (High)\n\n" + chrCtrl.MeshData();

        moduleSlider [0].maxValue = chrModule.modules.head.Length - 1;
        moduleSlider [1].maxValue = chrModule.modules.outfitUp.Length - 1;
        moduleSlider [2].maxValue = chrModule.modules.outfitDown.Length - 1;
        moduleSlider [3].maxValue = chrModule.modules.bag.Length - 1;


        textureSlider [0].maxValue = chrModule.modules.head[0].texCol.Length - 1;
        textureSlider [1].maxValue = chrModule.modules.outfitUp[0].texCol.Length - 1;
        textureSlider [2].maxValue = chrModule.modules.outfitDown[0].texCol.Length - 1;
        textureSlider [3].maxValue = chrModule.modules.bag[0].texCol.Length - 1;


        TextReaderState();
        GameObject ASelectGrid = GameObject.Find("Window_AnimationSelect/gridLayout");

        for (int i = 0; i < ASelectBtn.Length; i++)
        {
            ASelectBtn[i]   = ASelectGrid.transform.GetChild(i).gameObject;
            ASelectLabel[i] = ASelectBtn[i].GetComponentInChildren <Text>();
        }
        ASelectPage = GameObject.Find("Window_AnimationSelect/pageNumber").GetComponentInChildren <Text>();

        TextReaderIMinfo();
        MotionControlBtn(1);
        ChangeAnimator(0);
    }