-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: try closing the door every frame
- Loading branch information
1 parent
2e5073a
commit dec4af5
Showing
1 changed file
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEngine; | ||
|
||
namespace Hax; | ||
|
||
public class LockCommand : ICommand { | ||
public void Execute(string[] _) { | ||
public void Execute(string[] args) { | ||
List<DoorLock> doors = [.. Object.FindObjectsOfType<DoorLock>()]; | ||
|
||
_ = Helper.CreateComponent<TransientBehaviour>().Init((_) => { | ||
doors.ForEach(door => { | ||
AnimatedObjectTrigger animatedObjectTrigger = door.gameObject.GetComponent<AnimatedObjectTrigger>(); | ||
animatedObjectTrigger.boolValue = false; | ||
animatedObjectTrigger.TriggerAnimation(Helper.GetPlayer(0)); | ||
}); | ||
}, 60.0f); | ||
|
||
Object.FindObjectsOfType<TerminalAccessibleObject>() | ||
.ToList() | ||
.ForEach(terminalAccessibleObject => terminalAccessibleObject.SetDoorOpenServerRpc(false)); | ||
|
||
} | ||
} |