//ADV用SendMessageコマンドが実行されたタイミング void OnDoCommand(AdvCommandSendMessage command) { switch (command.Name) { case "3DOn": TreedOn(command); break; case "3DOff": TreedOff(command); break; case "RotateOn": RotateOn(command); break; case "RotateOff": RotateOff(command); break; case "Model": ModelOn(command); break; case "ModelOff": ModelOff(command); break; default: Debug.Log("Unknown Message:" + command.Name ); break; } }
//回転ON void RotateOn(AdvCommandSendMessage command) { if (!float.TryParse(command.Arg2, out rotSpped)) { rotSpped = 15; } //演出としてカメラを回す StartCoroutine("CoRotate3D"); }
//ADV用SendMessageコマンドの処理待ちタイミング void OnWait(AdvCommandSendMessage command) { switch (command.Name) { default: command.IsWait = false; break; } }
//回転ON void RotateOff(AdvCommandSendMessage command) { StopCoroutine("CoRotate3D"); }
//3D表示OFF void TreedOff(AdvCommandSendMessage command) { root3d.SetActive(false); StopAllCoroutines(); }
//3D表示ON void TreedOn(AdvCommandSendMessage command) { root3d.SetActive(true); }
//モデルの表示 void ModelOff(AdvCommandSendMessage command) { GameObject model = FindModel(command.Arg2); if (model != null) { model.SetActive(false); } }
//モデルの表示 void ModelOn(AdvCommandSendMessage command) { GameObject model = FindModel(command.Arg2); if (model != null) { model.SetActive(true); if (!string.IsNullOrEmpty(command.Arg3)) model.GetComponent<Animation>().CrossFade(command.Arg3); } }