本文整理汇总了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");
}
示例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");
}
示例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;
}