Exemple #1
0
        public InputData GetP2InputData()
        {
            if (IsReplayingLastRoundInput)
            {
                return(LastRoundP2Input[CurrentReplayingInputIndex]);
            }

            float time = Time.fixedTime - RoundStartTime;

            InputData p2Input = new InputData();

            if (BattleAI != null)
            {
                p2Input.Input |= BattleAI.GetNextAIInput();
            }
            else
            {
                p2Input.Input |= InputManager.Instance.GetButton(InputManager.Command.P2Left)
                                        ? (int)InputDefine.Left
                                        : 0;
                p2Input.Input |= InputManager.Instance.GetButton(InputManager.Command.P2Right)
                                        ? (int)InputDefine.Right
                                        : 0;
                p2Input.Input |= InputManager.Instance.GetButton(InputManager.Command.P2Attack)
                                        ? (int)InputDefine.Attack
                                        : 0;
            }

            p2Input.Time = time;

            if (debugP2Attack)
            {
                p2Input.Input |= (int)InputDefine.Attack;
            }

            if (debugP2Guard)
            {
                p2Input.Input |= (int)InputDefine.Right;
            }

            return(p2Input);
        }
Exemple #2
0
        void ChangeRoundState(RoundStateType state)
        {
            _roundState = state;
            switch (_roundState)
            {
            case RoundStateType.Stop:

                if (fighter1RoundWon >= maxRoundWon ||
                    fighter2RoundWon >= maxRoundWon)
                {
                    GameManager.Instance.LoadTitleScene();
                }

                break;

            case RoundStateType.Intro:

                fighter1.SetupBattleStart(fighterDataList[0], new Vector2(-2f, 0f), true);
                fighter2.SetupBattleStart(fighterDataList[0], new Vector2(2f, 0f), false);

                timer = introStateTime;

                roundUIAnimator.SetTrigger("RoundStart");

                if (GameManager.Instance.isVsCPU)
                {
                    battleAI = new BattleAI(this);
                }

                break;

            case RoundStateType.Fight:

                roundStartTime = Time.fixedTime;
                frameCount     = -1;

                currentRecordingInputIndex = 0;

                break;

            case RoundStateType.KO:

                timer = koStateTime;

                CopyLastRoundInput();

                fighter1.ClearInput();
                fighter2.ClearInput();

                battleAI = null;

                roundUIAnimator.SetTrigger("RoundEnd");

                break;

            case RoundStateType.End:

                timer = endStateTime;

                var deadFighter = _fighters.FindAll((f) => f.isDead);
                if (deadFighter.Count == 1)
                {
                    if (deadFighter[0] == fighter1)
                    {
                        fighter2RoundWon++;
                        fighter2.RequestWinAction();
                    }
                    else if (deadFighter[0] == fighter2)
                    {
                        fighter1RoundWon++;
                        fighter1.RequestWinAction();
                    }
                }

                break;
            }
        }