// Update is called once per frame public void UpdateMe() { // 通常営業時のみ操作狩野英孝 if (selectFlg == StageSelectFlg.NOMAL) { //======================================== // カーソル移動 //======================================== // ← if (Input.GetKeyDown(KeyCode.A)) { selecCursortpos--; // 左端 if (selecCursortpos < 1) { selecCursortpos = 1; } else { // カーソル移動開始 StartCoroutine(StartCursorMove(selecCursortpos + 1, selecCursortpos)); } } // → if (Input.GetKeyDown(KeyCode.D)) { selecCursortpos++; // 左端 if (selecCursortpos > stageMax) { selecCursortpos = stageMax; } else { // カーソル移動開始 StartCoroutine(StartCursorMove(selecCursortpos - 1, selecCursortpos)); } } //======================================== // 決定 //======================================== if (Input.GetKeyDown(KeyCode.Return)) { selectFlg = StageSelectFlg.SCENE_CHANGE; // シーン遷移 SceneChangeManager.Instance.SceneChangeOut(SceneChangeType.FADE, 0.5f, "Stage" + "1"); } //======================================== // タイトルに戻る //======================================== if (Input.GetKeyDown(KeyCode.Backspace)) { selectFlg = StageSelectFlg.SCENE_CHANGE; // シーン遷移 SceneChangeManager.Instance.SceneChangeOut(SceneChangeType.FADE, 0.4f, "Title"); } } }
//======================================== // 1:カーソル移動 //======================================== IEnumerator StartCursorMove(int _nowCursorPos, int _nextCursorPos) { selectFlg = StageSelectFlg.MOVE; // 既存のパネルを破棄 StopCoroutine(panelAnimEvent); Destroy(selectPanelObj); //!< スクリプトを取得 StageSelectCursor stageSelectCursorCS = cursorObj.GetComponent <StageSelectCursor>(); //!< カーソル移動呼び出し Vector3 firstPos = mapPlane[_nowCursorPos - 1].transform.position; Vector3 lastPos = mapPlane[_nextCursorPos - 1].transform.position; yield return(StartCoroutine(stageSelectCursorCS.MoveAnimation(cursorSpeed, firstPos, lastPos))); // flg切り替え (操作可能に) selectFlg = StageSelectFlg.NOMAL; // カーソル移動が終了次第、新規セレクトパネル生成 ChangeSelectPanel(selecCursortpos); }
//======================================== // 2:セレクトパネル情報更新 //======================================== void ChangeSelectPanel(int _stageNo) { //!< パネルを生成 GameObject prefab = (GameObject)Resources.Load("SELECT_PANEL_SET"); selectPanelObj = Instantiate(prefab, cursorObj.transform.position, Quaternion.identity); // キャンバスに配置 //selectPanelObj.transform.SetParent(GameObject.Find("Canvas").transform); selectPanelObj.transform.SetParent(cursorObj.transform); // 角度傾き selectPanelObj.transform.Rotate(0.0f, 0.0f, 4.0f, Space.World); //!< パネルに情報をセット SelectPanelManager selectPanelManager = selectPanelObj.GetComponent <SelectPanelManager>(); selectPanelManager.SetInfo(selecCursortpos); // アニメーション作成 //yield return StartCoroutine(selectPanelManager.MoveAnimation(0.1f)); panelAnimEvent = selectPanelManager.MoveAnimation(panelSpeed); StartCoroutine(panelAnimEvent); // パネルがアニメーション終了してからflg切り替え (操作可能に) selectFlg = StageSelectFlg.NOMAL; }