diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..0d05c4be --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,56 @@ +{ + "files.exclude": + { + "**/.DS_Store":true, + "**/.git":true, + "**/.gitmodules":true, + "**/*.booproj":true, + "**/*.pidb":true, + "**/*.suo":true, + "**/*.user":true, + "**/*.userprefs":true, + "**/*.unityproj":true, + "**/*.dll":true, + "**/*.exe":true, + "**/*.pdf":true, + "**/*.mid":true, + "**/*.midi":true, + "**/*.wav":true, + "**/*.gif":true, + "**/*.ico":true, + "**/*.jpg":true, + "**/*.jpeg":true, + "**/*.png":true, + "**/*.psd":true, + "**/*.tga":true, + "**/*.tif":true, + "**/*.tiff":true, + "**/*.3ds":true, + "**/*.3DS":true, + "**/*.fbx":true, + "**/*.FBX":true, + "**/*.lxo":true, + "**/*.LXO":true, + "**/*.ma":true, + "**/*.MA":true, + "**/*.obj":true, + "**/*.OBJ":true, + "**/*.asset":true, + "**/*.cubemap":true, + "**/*.flare":true, + "**/*.mat":true, + "**/*.meta":true, + "**/*.prefab":true, + "**/*.unity":true, + "build/":true, + "Build/":true, + "Library/":true, + "library/":true, + "obj/":true, + "Obj/":true, + "ProjectSettings/":true, + "temp/":true, + "Temp/":true + }, + "dotnet.preferCSharpExtension": true +} \ No newline at end of file diff --git a/Assets/Scripts/Interactables/LightSwitchView.cs b/Assets/Scripts/Interactables/LightSwitchView.cs index e96c6032..570b84c6 100644 --- a/Assets/Scripts/Interactables/LightSwitchView.cs +++ b/Assets/Scripts/Interactables/LightSwitchView.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using UnityEngine; using static LightSwitchView; @@ -6,16 +7,18 @@ public class LightSwitchView : MonoBehaviour, IInteractable { [SerializeField] private List lightsources = new List(); private SwitchState currentState; - public delegate void LightSwitchDelegate(); - public static LightSwitchDelegate lightToggled; + //public delegate void LightSwitchDelegate(); + //public static event LightSwitchDelegate lightToggled; - private void OnEnable() => lightToggled += onLightSwitch; + public static event Action lightToggledAction; - private void OnDisable() => lightToggled -= onLightSwitch; + private void OnEnable() => lightToggledAction += onLightSwitch; + + private void OnDisable() => lightToggledAction -= onLightSwitch; private void Start() => currentState = SwitchState.Off; - public void Interact() => lightToggled?.Invoke(); + public void Interact() => lightToggledAction?.Invoke(); private void toggleLights() { diff --git a/Assets/Scripts/Player/PlayerController.cs b/Assets/Scripts/Player/PlayerController.cs index 054fc215..bd0e4bd6 100644 --- a/Assets/Scripts/Player/PlayerController.cs +++ b/Assets/Scripts/Player/PlayerController.cs @@ -25,13 +25,13 @@ public PlayerController(PlayerView playerView, PlayerScriptableObject playerScri this.playerScriptableObject = playerScriptableObject; this.playerScriptableObject.KeysEquipped = 0; - LightSwitchView.lightToggled += onLightSwitch; + LightSwitchView.lightToggledAction += onLightSwitch; playerState = PlayerState.InDark; } ~PlayerController() { - LightSwitchView.lightToggled -= onLightSwitch; + LightSwitchView.lightToggledAction -= onLightSwitch; } public void Interact() => IsInteracted = Input.GetKeyDown(KeyCode.E) ? true : (Input.GetKeyUp(KeyCode.E) ? false : IsInteracted);