// Start is called before the first frame update void Start() { audioSource = GetComponent <AudioSource>(); dir = (transform.localScale.x > 0.0f) ? 1 : -1; // tada defaultScaleX = transform.localScale.x * dir; transform.localScale = new Vector3( defaultScaleX, transform.localScale.y, transform.localScale.z); animator = GetComponent <Animator>(); menuCtrl = GetComponent <MenuController>(); // すべてのstageStateから現在のステージ場所を全探索する テーブル作るより楽で簡潔になった foreach (Transform child in stageObjectList.transform) // 少し重そうなのが欠点 { if (nowStageId == child.GetComponent <StageState>().stageId) { nowStageState = child.GetComponent <StageState>(); break; } } if (!StageTable.alreadyExplanation) { StartCoroutine(FirstExplanation()); StageTable.alreadyExplanation = true; } ChangeStageInfo(); SetArrow(); ShowStageName(); transform.position = nowStageState.transform.position; // ついでにカメラの位置も変える //Camera.main.transform.position = new Vector3(transform.position.x, transform.position.y, -10f); prevPos = transform.position; MusicManager.Play(MusicManager.Instance.bgm2); }
// ステージステートを移動先のにセットする private void ChangeStageState(MoveDirection dir) { switch (dir) { case MoveDirection.UP: nowStageState = nowStageState.nextStage.upStage; break; case MoveDirection.RIGHT: nowStageState = nowStageState.nextStage.rightStage; break; case MoveDirection.DOWN: nowStageState = nowStageState.nextStage.downStage; break; case MoveDirection.LEFT: nowStageState = nowStageState.nextStage.leftStage; break; } ChangeStageInfo(); SwitchArrow(!isMoving); }