This commit is contained in:
Ignis 2021-08-28 12:25:16 +02:00
commit 3e5ea074fe
3 changed files with 9 additions and 14 deletions

View file

@ -172,9 +172,9 @@ public class @PlayerControls : IInputActionCollection, IDisposable
}, },
{ {
""name"": ""Interact"", ""name"": ""Interact"",
""type"": ""Button"", ""type"": ""Value"",
""id"": ""441a993f-cce4-4bfb-93b1-5a5a64659cc2"", ""id"": ""441a993f-cce4-4bfb-93b1-5a5a64659cc2"",
""expectedControlType"": ""Button"", ""expectedControlType"": """",
""processors"": """", ""processors"": """",
""interactions"": """" ""interactions"": """"
}, },

View file

@ -159,9 +159,9 @@
}, },
{ {
"name": "Interact", "name": "Interact",
"type": "Button", "type": "Value",
"id": "441a993f-cce4-4bfb-93b1-5a5a64659cc2", "id": "441a993f-cce4-4bfb-93b1-5a5a64659cc2",
"expectedControlType": "Button", "expectedControlType": "",
"processors": "", "processors": "",
"interactions": "" "interactions": ""
}, },

View file

@ -6,10 +6,6 @@ using NaughtyAttributes;
public class Trap : MonoBehaviour public class Trap : MonoBehaviour
{ {
[Header("Debug")] [Header("Debug")]
public bool showReachRangeSphere; public bool showReachRangeSphere;
@ -26,7 +22,7 @@ public class Trap : MonoBehaviour
public bool isActivated; public bool isActivated;
public bool playerInRange; public bool playerInRange;
public bool robberInRange; public bool robberInRange;
public PlayerControls.DobberControlsActions dobberControls; public PlayerControls dobberControls;
public InputReferences inputReferences; public InputReferences inputReferences;
public Material unsetMaterial; public Material unsetMaterial;
public Material setMaterial; public Material setMaterial;
@ -101,7 +97,7 @@ public class Trap : MonoBehaviour
private void Awake() private void Awake()
{ {
dobberControls = new PlayerControls.DobberControlsActions(); dobberControls = new PlayerControls();
dobberControls.Enable(); dobberControls.Enable();
} }
@ -109,11 +105,10 @@ public class Trap : MonoBehaviour
{ {
if (Physics.CheckSphere(transform.position + trapInteractionRadiusOffset, trapInteractionRadius)) if (Physics.CheckSphere(transform.position + trapInteractionRadiusOffset, trapInteractionRadius))
{ {
switch (interacted) switch (interacted)
{ {
case 1:
case 1:
Debug.Log("trap collected"); Debug.Log("trap collected");
isSet = false; isSet = false;
GetComponent<MeshRenderer>().sharedMaterial = setMaterial; GetComponent<MeshRenderer>().sharedMaterial = setMaterial;
@ -139,7 +134,7 @@ public class Trap : MonoBehaviour
{ {
Debug.Log("The robber set off the trap."); Debug.Log("The robber set off the trap.");
isActivated = false; isActivated = false;
this.GetComponent<MeshRenderer>().sharedMaterial = unsetMaterial; GetComponent<MeshRenderer>().sharedMaterial = unsetMaterial;
} }
} }