From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- Client/Assembly-CSharp/AutoOpenDoor.cs | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Client/Assembly-CSharp/AutoOpenDoor.cs (limited to 'Client/Assembly-CSharp/AutoOpenDoor.cs') 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); + } +} -- cgit v1.1-26-g67d0