当前位置: 首页>>代码示例>>C#>>正文


C# GameState.GetEntityByName方法代码示例

本文整理汇总了C#中GameState.GetEntityByName方法的典型用法代码示例。如果您正苦于以下问题:C# GameState.GetEntityByName方法的具体用法?C# GameState.GetEntityByName怎么用?C# GameState.GetEntityByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameState的用法示例。


在下文中一共展示了GameState.GetEntityByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnSessionStart

        public override void OnSessionStart(GameState state)
        {
            base.OnSessionStart(state);

            _onceFlag = false;
            _startDetectEntity = IntPtr.Zero;
            _endDetectEntity = IntPtr.Zero;

            if (this.IsFirstMap)
                _startDetectEntity = state.GetEntityByName("ghostanim_DogIntro");
            else if (this.IsLastMap)
                _endDetectEntity = state.GetEntityByName("outro_train_1");
        }
开发者ID:RedHaze,项目名称:sourcesplit,代码行数:13,代码来源:HL2Ep1.cs

示例2: OnSessionStart

        public override void OnSessionStart(GameState state)
        {
            base.OnSessionStart(state);

            _onceFlag = false;
            _endDetectEntityPtr = IntPtr.Zero;

            if (this.IsLastMap)
                _endDetectEntityPtr = state.GetEntityByName("atw_c_note");
        }
开发者ID:RedHaze,项目名称:sourcesplit,代码行数:10,代码来源:ApertureTag.cs

示例3: OnUpdate

        public override GameSupportResult OnUpdate(GameState state)
        {
            if (this.IsFirstMap)
                return base.OnUpdate(state);
            else if (!this.IsLastMap || _onceFlag)
                return GameSupportResult.DoNothing;

            // GetEntityByName is rather expensive so don't check every tick
            // there's a period of about 10-15 seconds from when it's created until it's used, so a 5 second
            // interval should be good enough
            if (_endDetectEntity == IntPtr.Zero && state.TickTime - _lastEntCheckTime > 5.0f)
            {
                Debug.WriteLine("checking for ending_vehicle ent");
                _endDetectEntity = state.GetEntityByName("ending_vehicle");
                _lastEntCheckTime = state.TickTime;

                if (_endDetectEntity != IntPtr.Zero)
                {
                    Debug.WriteLine("_endDetectEntity = 0x" + _endDetectEntity.ToString("X"));
                    state.GameProcess.ReadBool(_endDetectEntity + CPropVehicleChoreoGenericPlayerCanShootOffset, out _prevCanShoot);
                }
            }

            // "OnTrigger" "ending_vehicle SetCanShoot 0 0 -1"
            if (_endDetectEntity != IntPtr.Zero)
            {
                bool canShoot;
                state.GameProcess.ReadBool(_endDetectEntity + CPropVehicleChoreoGenericPlayerCanShootOffset, out canShoot);

                if (!canShoot && _prevCanShoot)
                {
                    Debug.WriteLine("portal 2 ending detection");
                    _onceFlag = true;
                    _endDetectEntity = IntPtr.Zero;
                    return GameSupportResult.PlayerLostControl;
                }

                _prevCanShoot = canShoot;
            }

            return GameSupportResult.DoNothing;
        }
开发者ID:RedHaze,项目名称:sourcesplit,代码行数:42,代码来源:Portal2.cs


注:本文中的GameState.GetEntityByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。