コード例 #1
0
            /// <summary>Executes the state.</summary>
            /// <param name="hovertank">The hover tank game.</param>
            /// <returns>The next state to set or null.</returns>
            public override State Execute(Hovertank hovertank)
            {
                State nextState = null;

                if(_decisionIndex != _decisions.Count - 1)
                {
                    hovertank.CenterWindow(_width, _height);

                    Decision decision = _decisions[_decisionIndex + 1];
                    switch(decision)
                    {
                        case Decision.None:
                            nextState = _nextState;
                            break;

                        case Decision.ExpWin:
                            _width += 2;
                            _height += 2;
                            break;

                        case Decision.ExpWinH:
                            _width += 2;
                            break;

                        case Decision.ExpWinV:
                            _height += 2;
                            break;
                    }
                }

                _decisionIndex--;

                if(nextState == null)
                {
                    // WaitVBL(1);
                    hovertank._stateWaitVBL.Initialise(hovertank, 1, hovertank._stateExpWin);
                    nextState = hovertank._stateWaitVBL;
                }

                return nextState;
            }