本文整理汇总了C#中Door.SetFieldValue方法的典型用法代码示例。如果您正苦于以下问题:C# Door.SetFieldValue方法的具体用法?C# Door.SetFieldValue怎么用?C# Door.SetFieldValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Door
的用法示例。
在下文中一共展示了Door.SetFieldValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: On_DoorUse
/// <summary>
/// Called from <c>Door.RPC_OpenDoor(BaseEntity.RPCMessage)</c> and <c>Door.RPC_CloseDoor(BaseEntity.RPCMessage)</c> .
/// </summary>
public static void On_DoorUse(Door door, BaseEntity.RPCMessage msg, bool open)
{
if ((open && door.IsOpen()) || (!open && !door.IsOpen()))
return;
var preDoorUseEvent = new Pre<DoorUseEvent>(door, msg, open);
OnNext("Pre_DoorUse", preDoorUseEvent);
if (preDoorUseEvent.IsCanceled) {
if (preDoorUseEvent.Event.DenyReason != "")
msg.player.SendConsoleCommand("chat.add",
0,
String.Format("{0}: {1}",
Server.server_message_name.ColorText("fa5"),
preDoorUseEvent.Event.DenyReason));
return;
}
bool doAction = true;
BaseLock baseLock = door.GetSlot(BaseEntity.Slot.Lock) as BaseLock;
if (baseLock != null && preDoorUseEvent.Event.IgnoreLock == false) {
doAction = open ? baseLock.OnTryToOpen(msg.player) : baseLock.OnTryToClose(msg.player);
if (doAction && open && (baseLock.IsLocked() && Time.realtimeSinceStartup - (float)door.GetFieldValue("decayResetTimeLast") > 60)) {
Decay.RadialDecayTouch(door.transform.position, 40, 270532608);
door.SetFieldValue("decayResetTimeLast", Time.realtimeSinceStartup);
}
}
if (doAction) {
door.SetFlag(BaseEntity.Flags.Open, open);
door.SendNetworkUpdateImmediate(false);
door.CallMethod("UpdateDoorAnimationParameters", false);
OnNext("On_DoorUse", preDoorUseEvent.Event);
}
}