本文整理匯總了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;
}