diff options
Diffstat (limited to 'Client/Assembly-CSharp/AutoOpenDoor.cs')
-rw-r--r-- | Client/Assembly-CSharp/AutoOpenDoor.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/AutoOpenDoor.cs b/Client/Assembly-CSharp/AutoOpenDoor.cs new file mode 100644 index 0000000..da09c70 --- /dev/null +++ b/Client/Assembly-CSharp/AutoOpenDoor.cs @@ -0,0 +1,37 @@ +using System; + +public class AutoOpenDoor : ManualDoor +{ + private const float ClosedDuration = 10f; + + public SystemTypes Room; + + public float ClosedTimer; + + public float CooldownTimer; + + public bool DoUpdate(float dt) + { + this.CooldownTimer = Math.Max(this.CooldownTimer - dt, 0f); + if (this.ClosedTimer > 0f) + { + this.ClosedTimer = Math.Max(this.ClosedTimer - dt, 0f); + if (this.ClosedTimer == 0f) + { + this.SetDoorway(true); + return true; + } + } + return false; + } + + public override void SetDoorway(bool open) + { + if (!open) + { + this.ClosedTimer = 10f; + this.CooldownTimer = 30f; + } + base.SetDoorway(open); + } +} |