// Update is called once per frame void Update() { ReadyingTime++; // 現在のアニメーター・ステートに紐づいたデータ AcStateRecordable astateRecord0 = AControl.Instance.GetCurrentAcStateRecord(player_to_animator[(int)PlayerIndex.Player1]); AcStateRecordable astateRecord1 = AControl.Instance.GetCurrentAcStateRecord(player_to_animator[(int)PlayerIndex.Player2]); if ( AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_READY)].Name == astateRecord0.Name && AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_READY)].Name == astateRecord1.Name ) { // 1プレイヤー、2プレイヤー ともに Ready ステートなら。 player_to_animator[(int)PlayerIndex.Player1].SetTrigger(SceneCommon.TRIGGER_TIMEOVER); player_to_animator[(int)PlayerIndex.Player2].SetTrigger(SceneCommon.TRIGGER_TIMEOVER); SceneCommon.TransitionTime = 1; } if (0 < SceneCommon.TransitionTime) { SceneCommon.TransitionTime++; if (5 == SceneCommon.TransitionTime) { SceneManager.LoadScene(CommonScript.Scene_to_name[(int)SceneIndex.Main]); } } }
// Update is called once per frame void Update() { ReadyingTime++; // 現在のアニメーター・ステートに紐づいたデータ AcStateRecordable astateRecord0 = AControl.Instance.GetCurrentAcStateRecord(animators[PlayerIndex.Player1]); AcStateRecordable astateRecord1 = AControl.Instance.GetCurrentAcStateRecord(animators[PlayerIndex.Player2]); if ( AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_READY)].Name == astateRecord0.Name && AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_READY)].Name == astateRecord1.Name ) { // 1プレイヤー、2プレイヤー ともに Ready ステートなら。 animators[PlayerIndex.Player1].SetTrigger(ThisSceneDto.TriggerTimeOver); animators[PlayerIndex.Player2].SetTrigger(ThisSceneDto.TriggerTimeOver); ThisSceneDto.TransitionTime = 1; } if (0 < ThisSceneDto.TransitionTime) { ThisSceneDto.TransitionTime++; if (5 == ThisSceneDto.TransitionTime) { SceneManager.LoadScene(CommonScript.Scene_to_name[(int)SceneIndex.Fight]); } } }
// Update is called once per frame void Update() { // 現在のアニメーター・ステートに紐づいたデータ AcStateRecordable astateRecord = AControl.Instance.GetCurrentAcStateRecord(animator); #region 入力受付と途中参加 CommonInput.PlayerInput input = CommonInput.Update((PlayerIndex)playerIndex); // 人間の途中参加受付 if ( CommonScript.Player_to_computer[playerIndex] && // コンピュータープレイヤーの場合 ( // レバーはコンピューターもいじっているので、区別できない。 // 0 != leverX || // 0 != leverY || 0 != input.leverX || 0 != input.leverY || input.pressingLP || input.pressingMP || input.pressingHP || input.pressingLK || input.pressingMK || input.pressingHK || input.pressingPA || input.pressingCA )) { Debug.Log("途中参加 " + playerIndex + " プレイヤー" + " leverX = " + input.leverX + " leverY = " + input.leverY); // コンピューター・プレイヤー側のゲームパッドで、何かボタンを押したら、人間の参入。 CommonScript.Player_to_computer[playerIndex] = false; // FIXME: 硬直時間を入れたい。 return; } if (CommonScript.Player_to_computer[playerIndex]) { input.leverX = Random.Range(-1.0f, 1.0f); input.pressingLP = false; input.pressingMP = false; input.pressingHP = false; input.pressingLK = false; input.pressingMK = false; input.pressingHK = false; input.pressingPA = false; input.pressingCA = false; } else { input.leverX = Input.GetAxisRaw(CommonInput.PlayerAndInput_to_inputName[playerIndex, (int)InputIndex.Horizontal]); } #endregion if (AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_STAY)].Name == astateRecord.Name) { //カーソル移動中でなければ。 if (CommonScript.Player_to_computer[playerIndex])// コンピュータープレイヤーの場合 { if (Select_CameraScript.READY_TIME_LENGTH < mainCameraScript.ReadyingTime) { input.pressingLP = (0.5 < Random.Range(0.0f, 1.0f)); // たまにパンチ・キーを押して決定する。 } } if ( input.pressingLP || input.pressingMP || input.pressingHP || input.pressingLK || input.pressingMK || input.pressingHK || input.pressingPA ) { // 何かボタンを押したら、キャラクター選択。 animator.SetTrigger(SceneCommon.TRIGGER_SELECT); } else if (input.leverX != 0.0f)//左か右を入力したら { //Debug.Log("slide lever x = " + leverX.ToString()); if (input.leverX < 0.0f) { cursorColumn--; if (cursorColumn < 0) { cursorColumn = 2; } } else { cursorColumn++; if (2 < cursorColumn) { cursorColumn = 0; } } //Debug.Log("slide pos = " + cursorColumn[iPlayerIndex]); animator.SetTrigger(SceneCommon.TRIGGER_MOVE); ChangeCharacter(); //入力方向へ移動 //rigidbody2Ds[iPlayerIndex].velocity = new Vector2(leverX * cursorSpeed, rigidbody2Ds[iPlayerIndex].velocity.y); SlideIn(); } else // ボタン押下も、レバー左右入力もしていなかったら { //横移動の速度を0にしてピタッと止まるようにする myRigidbody2D.velocity = new Vector2(0, myRigidbody2D.velocity.y); } } else if (AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_MOVE)].Name == astateRecord.Name) { } else if (AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_READY)].Name == astateRecord.Name) { // キャラクター選択済みのとき if ( !CommonScript.Player_to_computer[playerIndex] // 人間プレイヤーの場合 && ( input.pressingLK || input.pressingMK || input.pressingHK || input.pressingCA )) { // キック・ボタンを押したら、キャンセル☆ animator.SetTrigger(SceneCommon.TRIGGER_STAY); } } }
// Update is called once per frame void Update() { var player = PlayerIndexes.FromArrayIndex(this.playerIndex); // 現在のアニメーター・ステートに紐づいたデータ AcStateRecordable astateRecord = AControl.Instance.GetCurrentAcStateRecord(animator); #region 入力受付と途中参加 InputStateDto input = ApplicationDto.ReadInput(player); // 人間の途中参加受付 if ( CommonScript.computerFlags[player] && // コンピュータープレイヤーの場合 ( // レバーはコンピューターもいじっているので、区別できない。 // 0 != leverX || // 0 != leverY || 0 != input.LeverX || 0 != input.LeverY || input.Lp.Pressing || input.Mp.Pressing || input.Hp.Pressing || input.Lk.Pressing || input.Mk.Pressing || input.Hk.Pressing || input.Pause.Pressing || input.CancelMenu.Pressing )) { Debug.Log("途中参加 " + player + " プレイヤー" + " leverX = " + input.LeverX + " leverY = " + input.LeverY); // コンピューター・プレイヤー側のゲームパッドで、何かボタンを押したら、人間の参入。 CommonScript.computerFlags[player] = false; // FIXME: 硬直時間を入れたい。 return; } if (CommonScript.computerFlags[player]) { input.LeverX = Random.Range(-1.0f, 1.0f); input.Lp.Pressing = false; input.Mp.Pressing = false; input.Hp.Pressing = false; input.Lk.Pressing = false; input.Mk.Pressing = false; input.Hk.Pressing = false; input.Pause.Pressing = false; input.CancelMenu.Pressing = false; } else { input.LeverX = Input.GetAxisRaw(InputNames.Dictionary[new InputIndex(player, ButtonIndex.Horizontal)]); } #endregion if (AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_STAY)].Name == astateRecord.Name) { //カーソル移動中でなければ。 if (CommonScript.computerFlags[player])// コンピュータープレイヤーの場合 { if (CameraBehaviour.READY_TIME_LENGTH < mainCameraScript.ReadyingTime) { input.Lp.Pressing = (0.5 < Random.Range(0.0f, 1.0f)); // たまにパンチ・キーを押して決定する。 } } if ( input.Lp.Pressing || input.Mp.Pressing || input.Hp.Pressing || input.Lk.Pressing || input.Mk.Pressing || input.Hk.Pressing || input.Pause.Pressing ) { // 何かボタンを押したら、キャラクター選択。 animator.SetTrigger(ThisSceneDto.TriggerSelect); } else if (input.LeverX != 0.0f)//左か右を入力したら { //Debug.Log("slide lever x = " + leverX.ToString()); if (input.LeverX < 0.0f) { cursorColumn--; if (cursorColumn < 0) { cursorColumn = 2; } } else { cursorColumn++; if (2 < cursorColumn) { cursorColumn = 0; } } //Debug.Log("slide pos = " + cursorColumn[iPlayerIndex]); animator.SetTrigger(ThisSceneDto.TriggerMove); ChangeCharacter(); //入力方向へ移動 //rigidbody2Ds[iPlayerIndex].velocity = new Vector2(leverX * cursorSpeed, rigidbody2Ds[iPlayerIndex].velocity.y); SlideIn(); } else // ボタン押下も、レバー左右入力もしていなかったら { //横移動の速度を0にしてピタッと止まるようにする myRigidbody2D.velocity = new Vector2(0, myRigidbody2D.velocity.y); } } else if (AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_MOVE)].Name == astateRecord.Name) { } else if (AControl.Instance.StateHash_to_record[Animator.StringToHash(Select_Cursor_AbstractAControl.BASELAYER_READY)].Name == astateRecord.Name) { // キャラクター選択済みのとき if ( !CommonScript.computerFlags[player] // 人間プレイヤーの場合 && ( input.Lk.Pressing || input.Mk.Pressing || input.Hk.Pressing || input.CancelMenu.Pressing )) { // キック・ボタンを押したら、キャンセル☆ animator.SetTrigger(ThisSceneDto.TriggerStay); } } }
/// <summary> /// 独自フィールドなどを追加している場合、レコードを丸ごと差し替えてください。 /// </summary> /// <param name="record">拡張クラスなど</param> public void Set(AcStateRecordable record) { StateHash_to_record[Animator.StringToHash(record.Fullpath)] = record; }