本文整理汇总了C#中BasePlayer.IsSleeping方法的典型用法代码示例。如果您正苦于以下问题:C# BasePlayer.IsSleeping方法的具体用法?C# BasePlayer.IsSleeping怎么用?C# BasePlayer.IsSleeping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasePlayer
的用法示例。
在下文中一共展示了BasePlayer.IsSleeping方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PutToSleep
static void PutToSleep(BasePlayer player)
{
if (!player.IsSleeping())
{
player.SetPlayerFlag(BasePlayer.PlayerFlags.Sleeping, true);
if (!BasePlayer.sleepingPlayerList.Contains(player))
{
BasePlayer.sleepingPlayerList.Add(player);
}
player.CancelInvoke("InventoryUpdate");
player.inventory.crafting.CancelAll(true);
}
}
示例2: OnEntityTakeDamage
/////////////////////////////////////////
// OnEntityAttacked(BaseCombatEntity entity, HitInfo hitinfo)
// Called when any entity is attacked
/////////////////////////////////////////
void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitinfo)
{
if (entity is BasePlayer)
{
cachedPlayer = entity as BasePlayer;
if (cachedPlayer.IsSleeping())
{
if (hasTag(cachedPlayer, "sleepgod"))
CancelDamage(hitinfo);
}
else if (hitinfo.Initiator != null)
{
if (hitinfo.Initiator is BasePlayer)
{
if (hasTag(cachedPlayer, "pvpgod"))
CancelDamage(hitinfo);
}
else if (hasTag(cachedPlayer, "pvegod"))
CancelDamage(hitinfo);
}
}
else if (entity is BaseCombatEntity)
{
BaseCombatEntity block = entity as BaseCombatEntity;
if (buildingZones[block] == null) return;
foreach(Zone zone in buildingZones[block])
{
if(zone.info.undestr != null)
{
CancelDamage(hitinfo);
}
}
}
else if(entity is WorldItem)
{
if (hitinfo != null && hitinfo.Initiator != null)
{
if (hitinfo.Initiator is BasePlayer)
{
if (hasTag(hitinfo.Initiator as BasePlayer, "undestr"))
CancelDamage(hitinfo);
}
}
}
}
示例3: Awake
public void Awake(BasePlayer player)
{
if (player.IsSleeping())
{
player.EndSleeping();
}
}