void Update() { // 透明なところではホイール操作は受け付けなくする if (windowController && cameraController) { Vector2 pos = Input.mousePosition; bool inScreen = (pos.x >= 0 && pos.x < Screen.width && pos.y >= 0 && pos.y < Screen.height); if (!windowController.isClickThrough && inScreen) { if (uiController) { originalWheelMode = uiController.zoomMode; } cameraController.zoomMode = originalWheelMode; } else { cameraController.zoomMode = CameraController.ZoomMode.None; } } // End を押すとウィンドウ透過切替 if (Input.GetKeyDown(KeyCode.End)) { windowController.SetTransparent(!windowController.isTransparent); } // Home を押すと最前面切替 if (Input.GetKeyDown(KeyCode.Home)) { windowController.SetTopmost(!windowController.isTopmost); } // F11 を押すと最大化切替 if (Input.GetKeyDown(KeyCode.F11)) { windowController.SetMaximized(!windowController.isMaximized); } // Insert を押すと最小化切替 if (Input.GetKeyDown(KeyCode.Insert)) { windowController.SetMinimized(!windowController.isMinimized); } }
// Use this for initialization void Start() { if (!uiController) { uiController = FindObjectOfType <VrmUiController>(); } if (!cameraController) { cameraController = FindObjectOfType <CameraController>(); if (cameraController) { originalWheelMode = cameraController.zoomMode; } } if (!audioSource) { audioSource = FindObjectOfType <AudioSource>(); } // Load the initial model. string[] cmdArgs = System.Environment.GetCommandLineArgs(); if (cmdArgs.Length > 1) { LoadModel(cmdArgs[1]); } else { LoadModel(Application.streamingAssetsPath + "/default_vrm.vrm"); } // Load the initial motion. LoadMotion(Application.streamingAssetsPath + "/default_bvh.txt"); // Initialize window manager windowController = FindObjectOfType <WindowController>(); if (windowController) { // Add a file drop handler. windowController.OnFilesDropped += Window_OnFilesDropped; } }
// Use this for initialization void Start() { // 指定がなければ自動で探す if (!uiController) { uiController = FindObjectOfType <VrmUiController>(); } uiController.enableRandomMotion = true; uiController.enableRandomEmotion = true; if (uiController.motionToggleRandom) { uiController.motionToggleRandom.onValueChanged.AddListener(val => SetRandomMotion(val)); } if (uiController.faceToggleRandom) { uiController.faceToggleRandom.onValueChanged.AddListener(val => SetRandomEmotion(val)); } // 指定がなければ自動で探す if (!canvas) { canvas = FindObjectOfType <Canvas>(); } // 指定がなければ自動で探す if (!cameraController) { cameraController = FindObjectOfType <CameraController>(); if (cameraController) { originalWheelMode = cameraController.zoomMode; } } // 指定がなければ自動で探す if (!audioSource) { audioSource = FindObjectOfType <AudioSource>(); } // Load the initial model. LoadModel(Application.streamingAssetsPath + "/default_vrm.vrm"); //// 引数でオプションが渡る場合の処理が面倒なため、引数でモデル指定は無しとする //string[] cmdArgs = System.Environment.GetCommandLineArgs(); //if (cmdArgs.Length > 1) //{ // LoadModel(cmdArgs[1]); //} else //{ // LoadModel(Application.streamingAssetsPath + "/default_vrm.vrm"); //} // Load the initial motion. LoadMotion(Application.streamingAssetsPath + "/default_bvh.txt"); // Initialize window manager windowController = FindObjectOfType <WindowController>(); if (windowController) { // Add a file drop handler. windowController.OnFilesDropped += Window_OnFilesDropped; if (uiController && uiController.openButton) { uiController.openButton.onClick.AddListener(() => { string path = windowController.ShowOpenFileDialog("VRM file|*.vrm|Motion file|*.bvh|Audio file|*.wav;*.ogg|All file|*.*"); LoadFile(path); }); } } }