本文整理汇总了C#中BaseEntity.IsValid方法的典型用法代码示例。如果您正苦于以下问题:C# BaseEntity.IsValid方法的具体用法?C# BaseEntity.IsValid怎么用?C# BaseEntity.IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseEntity
的用法示例。
在下文中一共展示了BaseEntity.IsValid方法的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();
}
}