Cannot Grapple Spikes anymore

This commit is contained in:
louishorlaville 2022-10-30 17:25:58 -04:00
parent b3a56f79bd
commit 1c8c15c7ef

View File

@ -92,14 +92,26 @@ public class GrappleHook : MonoBehaviour
hitMarkerRect.anchoredPosition = WorldToUI(gameObject.transform.position + aimDir * maxGrappleDist); hitMarkerRect.anchoredPosition = WorldToUI(gameObject.transform.position + aimDir * maxGrappleDist);
if (Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)) { if (Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)) {
if (hit.transform.gameObject.layer != 7)
{
hitMarkerRect.anchoredPosition = WorldToUI(hit.point); hitMarkerRect.anchoredPosition = WorldToUI(hit.point);
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green; hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green;
if(grappling){ if (grappling)
{
StartGrapple(hit); StartGrapple(hit);
}else{ }
else
{
grappling = false; grappling = false;
} }
}
else
{
hitMarkerRect.anchoredPosition = WorldToUI(hit.point);
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.red;
}
}else{ }else{
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.red; hitMarkerRect.gameObject.GetComponent<Image>().color = Color.red;
} }