Esempio n. 1
0
        void HandleGameSupportResult(GameSupportResult result, GameState state)
        {
            if (result == GameSupportResult.DoNothing)
            {
                return;
            }

            switch (result)
            {
            case GameSupportResult.PlayerGainedControl:
                this.SendGainedControlEvent(state.GameSupport.StartOffsetTicks * state.IntervalPerTick);
                break;

            case GameSupportResult.PlayerLostControl:
                this.SendLostControlEvent(state.GameSupport.EndOffsetTicks * state.IntervalPerTick);
                break;
            }
        }
Esempio n. 2
0
        void HandleGameSupportResult(GameSupportResult result, GameState state)
        {
            if (result == GameSupportResult.DoNothing)
                return;

            switch (result)
            {
                case GameSupportResult.PlayerGainedControl:
                    this.SendGainedControlEvent(state.GameSupport.StartOffsetTicks * state.IntervalPerTick);
                    break;
                case GameSupportResult.PlayerLostControl:
                    this.SendLostControlEvent(state.GameSupport.EndOffsetTicks * state.IntervalPerTick);
                    break;
            }
        }
Esempio n. 3
0
        public override GameSupportResult OnUpdate(GameState state)
        {
            StartOffsetTicks = EndOffsetTicks = 0;

            if (_onceFlag)
            {
                return(GameSupportResult.DoNothing);
            }

            if (this.IsLastMap)
            {
                _nihiHP.Update(state.GameProcess);

                if (_nihiHP.Current <= 0 && _nihiHP.Old > 0)
                {
                    return(DefaultEnd("black mesa end"));
                }

                if (_nihiSplitCommand.BValue)
                {
                    _nihiPhaseCounter.Update(state.GameProcess);

                    if (_nihiPhaseCounter.Current - _nihiPhaseCounter.Old == 1 && _nihiPhaseCounter.Old != 0)
                    {
                        Debug.WriteLine("black mesa nihilanth phase " + _nihiPhaseCounter.Old + " end");
                        return(GameSupportResult.PlayerLostControl);
                    }
                }
            }
            else if (_ebEndCommand.BValue && state.CurrentMap.ToLower() == _ebEndMap)
            {
                if (state.PlayerViewEntityIndex.Current == _ebCamIndex && state.PlayerViewEntityIndex.Old == 1)
                {
                    return(DefaultEnd("bms eb end"));
                }
            }
            else if ((_xenStartCommand.BValue || _xenSplitCommand.BValue) && state.CurrentMap.ToLower() == _xenStartMap)
            {
                if (state.PlayerViewEntityIndex.Current == 1 && state.PlayerViewEntityIndex.Old == _xenCamIndex)
                {
                    _onceFlag = true;
                    Debug.WriteLine("bms xen start");

                    GameSupportResult result = GameSupportResult.DoNothing;

                    if (_xenStartCommand.BValue && _getGlobalNameFuncPtr != IntPtr.Zero)
                    {
                        if (_roHandler.CallFunctionString("LC2XEN", _getGlobalNameFuncPtr) == uint.MaxValue)
                        {
                            if (_xenStartCommand.IValue == 1)
                            {
                                StartOffsetTicks = -_xenStartTick;
                            }
                            result = GameSupportResult.PlayerGainedControl;
                        }
                    }

                    return(_xenSplitCommand.BValue ? GameSupportResult.ManualSplit : result);
                }
            }

            return(GameSupportResult.DoNothing);
        }