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


C# BaseEntity.IsPlayer方法代码示例

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


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

示例1: Update

        public void Update()
        {
            //If the game processes is not running, close the cheat.
            if (!ProcUtils.ProcessIsRunning(Program.GameProcess))
                Environment.Exit(0);

            WindowTitle = GetActiveWindowTitle();
            if (WindowTitle != Program.GameTitle)
                return;

            var players = new List<Tuple<int, Player>>();
            var entities = new List<Tuple<int, BaseEntity>>();
            var weapons = new List<Tuple<int, Weapon>>();

            State = (SignOnState) Program.MemUtils.Read<int>((IntPtr) (ClientState + Offsets.ClientState.InGame));
            _localPlayer = Program.MemUtils.Read<int>((IntPtr) (ClientDllBase + Offsets.Misc.LocalPlayer));
            ViewMatrix = Program.MemUtils.ReadMatrix((IntPtr) _viewMatrix, 4, 4);


            //If we are not ingame do not update  
            if (State != SignOnState.SignonstateFull)
                return;

            var data = new byte[16*8192];
            Program.MemUtils.Read((IntPtr) _entityList, out data, data.Length);

            for (var i = 0; i < data.Length/16; i++)
            {
                var address = BitConverter.ToInt32(data, 16*i);
                if (address == 0) continue;
                var entity = new BaseEntity(address);
                if (!entity.IsValid())
                    continue;
                if (entity.IsPlayer())
                    players.Add(new Tuple<int, Player>(i, new Player(entity)));
                else if (entity.IsWeapon())
                    weapons.Add(new Tuple<int, Weapon>(i, new Weapon(entity)));
                else
                    entities.Add(new Tuple<int, BaseEntity>(i, entity));
            }

            Players = players.ToArray();
            Entities = entities.ToArray();
            Weapons = weapons.ToArray();

            //Check if our player exists
            if (players.Exists(x => x.Item2.Address == _localPlayer))
            {
                LocalPlayer = new LocalPlayer(players.First(x => x.Item2.Address == _localPlayer).Item2);
                LocalPlayerWeapon = LocalPlayer.GetActiveWeapon();
                //Only gets the weapon name and formates it properly and retunrs a string. Used for Weapon Configs
                WeaponSection = LocalPlayer.GetActiveWeaponName();
            }
        }
开发者ID:quibsorg,项目名称:CsGoAimbot,代码行数:54,代码来源:Memory.cs


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