From c4e92f1ba2c030948c64c1509dd9bf4cef0af1a2 Mon Sep 17 00:00:00 2001 From: NIMFER Date: Sat, 28 Aug 2021 12:24:54 +0200 Subject: [PATCH] trap fix --- Assets/Input/PlayerControls.cs | 4 ++-- Assets/Input/PlayerControls.inputactions | 4 ++-- Assets/Scripts/Trap.cs | 15 +++++---------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Assets/Input/PlayerControls.cs b/Assets/Input/PlayerControls.cs index 9853779..42df1bc 100644 --- a/Assets/Input/PlayerControls.cs +++ b/Assets/Input/PlayerControls.cs @@ -172,9 +172,9 @@ public class @PlayerControls : IInputActionCollection, IDisposable }, { ""name"": ""Interact"", - ""type"": ""Button"", + ""type"": ""Value"", ""id"": ""441a993f-cce4-4bfb-93b1-5a5a64659cc2"", - ""expectedControlType"": ""Button"", + ""expectedControlType"": """", ""processors"": """", ""interactions"": """" }, diff --git a/Assets/Input/PlayerControls.inputactions b/Assets/Input/PlayerControls.inputactions index f294c7b..e40d0fc 100644 --- a/Assets/Input/PlayerControls.inputactions +++ b/Assets/Input/PlayerControls.inputactions @@ -159,9 +159,9 @@ }, { "name": "Interact", - "type": "Button", + "type": "Value", "id": "441a993f-cce4-4bfb-93b1-5a5a64659cc2", - "expectedControlType": "Button", + "expectedControlType": "", "processors": "", "interactions": "" }, diff --git a/Assets/Scripts/Trap.cs b/Assets/Scripts/Trap.cs index be29cad..564f766 100644 --- a/Assets/Scripts/Trap.cs +++ b/Assets/Scripts/Trap.cs @@ -6,10 +6,6 @@ using NaughtyAttributes; public class Trap : MonoBehaviour { - - - - [Header("Debug")] public bool showReachRangeSphere; @@ -26,7 +22,7 @@ public class Trap : MonoBehaviour public bool isActivated; public bool playerInRange; public bool robberInRange; - public PlayerControls.DobberControlsActions dobberControls; + public PlayerControls dobberControls; public InputReferences inputReferences; public Material unsetMaterial; public Material setMaterial; @@ -101,7 +97,7 @@ public class Trap : MonoBehaviour private void Awake() { - dobberControls = new PlayerControls.DobberControlsActions(); + dobberControls = new PlayerControls(); dobberControls.Enable(); } @@ -109,11 +105,10 @@ public class Trap : MonoBehaviour { if (Physics.CheckSphere(transform.position + trapInteractionRadiusOffset, trapInteractionRadius)) { + switch (interacted) { - - - case 1: + case 1: Debug.Log("trap collected"); isSet = false; GetComponent().sharedMaterial = setMaterial; @@ -139,7 +134,7 @@ public class Trap : MonoBehaviour { Debug.Log("The robber set off the trap."); isActivated = false; - this.GetComponent().sharedMaterial = unsetMaterial; + GetComponent().sharedMaterial = unsetMaterial; } }