From 1c8c15c7efd5c539f6a903fae1f55324f50ffc1c Mon Sep 17 00:00:00 2001 From: louishorlaville Date: Sun, 30 Oct 2022 17:25:58 -0400 Subject: [PATCH] Cannot Grapple Spikes anymore --- Assets/Scripts/GrappleHook.cs | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/GrappleHook.cs b/Assets/Scripts/GrappleHook.cs index ddb7e98..87a7160 100644 --- a/Assets/Scripts/GrappleHook.cs +++ b/Assets/Scripts/GrappleHook.cs @@ -91,15 +91,27 @@ public class GrappleHook : MonoBehaviour if(!hitMarkerRect.gameObject.activeSelf)hitMarkerRect.gameObject.SetActive(true); hitMarkerRect.anchoredPosition = WorldToUI(gameObject.transform.position + aimDir * maxGrappleDist); - if(Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)){ - hitMarkerRect.anchoredPosition = WorldToUI(hit.point); - hitMarkerRect.gameObject.GetComponent().color = Color.green; - - if(grappling){ - StartGrapple(hit); - }else{ - grappling = false; + if (Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)) { + if (hit.transform.gameObject.layer != 7) + { + hitMarkerRect.anchoredPosition = WorldToUI(hit.point); + hitMarkerRect.gameObject.GetComponent().color = Color.green; + + if (grappling) + { + StartGrapple(hit); + } + else + { + grappling = false; + } } + else + { + hitMarkerRect.anchoredPosition = WorldToUI(hit.point); + hitMarkerRect.gameObject.GetComponent().color = Color.red; + } + }else{ hitMarkerRect.gameObject.GetComponent().color = Color.red; }