private string[] iModeMsg = new string[3]; // Information text on the left side of the screen, in Interactive mode. void Start() { // chrName = outfitGrpData.GetChrNameList (0); // Target to control of animator control script. chrCtrl = chrModel[activeLodIdx].GetComponent <NoteAnimatorControl>(); // 当前角色的控制 // set 3D model information. ModelInformationUI.GetComponentInChildren <Text>().text = chrCtrl.GetMeshData(); // 读取3d模型 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>(); // 设置按钮、文本框等信息,让角色执行第一个动画,即站立;模式设置为Viewer Mode TextReaderIMinfo(); MotionControlBtn(1); ChangeAnimator(0); }
// change character model. 更换角色模型 private IEnumerator ChangeLOD(GameObject currentActiveChr) { // play Idle 0.1 second before change character model. // It is prevent error of transform like weapon_point_hand // 0.1秒、IDLEを再生してからモデルを切り替える。. // 현재 표시 중인 모델에게 IDLE모션을 0.초간 재생시킨 후 처리를 시작한다. chrModel[activeLodIdx].GetComponent <NoteAnimatorControl>().PlayClip("Disappear"); yield return(new WaitForSeconds(0.3f)); activeLodIdx++; if (activeLodIdx == chrModel.Length) { activeLodIdx = 0; } // 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 <NoteAnimatorControl>(); // to display same place. chrModel[activeLodIdx].transform.position = currentActiveChr.transform.position; chrModel[activeLodIdx].transform.rotation = currentActiveChr.transform.rotation; chrModel[activeLodIdx].GetComponent <NoteAnimatorControl>().SetColor(); // play Idle. chrCtrl.PlayClip(stateName[0]); // set 3D model infomation newly. // meshInfoMsg = chrCtrl.MeshData(); ModelInformationUI.GetComponentInChildren <Text>().text = chrCtrl.GetMeshData(); // replace target of camera. gameObject.GetComponent <CamControl>().target = chrModel[activeLodIdx].transform; }